• Steve Jones - SSC Editor (5/18/2016)


    This is certainly an implementation issue (and a knowing of the standard that is being followed). However, that's part of why I thought it was an interesting question.

    I think there should be a default that says 0x00 and 0x0000 are equal. However perhaps there should be a choice by the programmer to decide if these should be equal or not. I have no idea how you'd do this, as the register would need to be padded in either case if it is longer than the value being stored.

    It looks like its more about specifying the size of the operand, but honestly I don't spend any time at that level. I've been spoiled by high level languages 😛

    http://www.c-jump.com/CIS77/CPU/x86/X77_0060_mod_reg_r_m_byte.htm

    In that case, should we take the overhead to somehow mark a length of the value?

    SQL has that covered, it apparently already marks the length. Otherwise how would it even know how to display the varbinary values?

    declare @a varbinary(8), @b-2 varbinary(8)

    set @a = 0x00

    set @b-2 = 0x0000

    select @a, @b-2

    This is a thorny situation, but certainly one that you need to be aware of if you work with varbinary fields.

    I agree with that, but I don't think we need to get mixed up in opcodes or registers. For that matter, you should unban Celko for long enough for him to talk about how we don't worry about implementation details when we're using our high level abstractions 😛