You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by Hiram Chirino <hi...@hiramchirino.com> on 2007/06/07 00:41:39 UTC
Re: char signedness
I vote keep it unsigned. Signed bytes in Java were a mistake IMO.
Almost every time I have to work with bytes in Java I have to do the
"& 0xFF" tricks to turn it unsigned.
Regards,
Hiram
On 5/25/07, Motl <mo...@orcsoftware.com> wrote:
>
> At the moment, 'unsigned char' is used for BytesMessage representation in
> C++, whereas signed char is used in Java, that means the same message will
> be encoded differently in Java and C++! I agree that 'unsigned char' (or,
> precisely, uint8_t) is more suitable for 'byte' type in C/C++, but if we
> follow JMS standard, we should use 'signed char' instead. The representation
> of signed chars isn't a part of ANSI C Standard, but most compilers use 2's
> complement, and so Java does.
> Hereby, I propose to replace unsigned char with signed one.
>
> --
> View this message in context: http://www.nabble.com/char-signedness-tf3814717s2354.html#a10798606
> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
>
>
--
Regards,
Hiram
Blog: http://hiramchirino.com
Re: char signedness
Posted by Timothy Bish <ta...@twcny.rr.com>.
Agreed, unsigned makes much more sense.
Hiram Chirino wrote:
> I vote keep it unsigned. Signed bytes in Java were a mistake IMO.
> Almost every time I have to work with bytes in Java I have to do the
> "& 0xFF" tricks to turn it unsigned.
>
> Regards,
> Hiram
>
> On 5/25/07, Motl <mo...@orcsoftware.com> wrote:
>>
>> At the moment, 'unsigned char' is used for BytesMessage
>> representation in
>> C++, whereas signed char is used in Java, that means the same
>> message will
>> be encoded differently in Java and C++! I agree that 'unsigned char'
>> (or,
>> precisely, uint8_t) is more suitable for 'byte' type in C/C++, but
>> if we
>> follow JMS standard, we should use 'signed char' instead. The
>> representation
>> of signed chars isn't a part of ANSI C Standard, but most compilers
>> use 2's
>> complement, and so Java does.
>> Hereby, I propose to replace unsigned char with signed one.
>>
>> --
>> View this message in context:
>> http://www.nabble.com/char-signedness-tf3814717s2354.html#a10798606
>> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
>>
>>
>
>
Re: char signedness
Posted by Motl <mo...@orcsoftware.com>.
Yes, I'm doing it right now ) It's not a problem for me, so I just proposed.
Tim Bish wrote:
>
> There really isn't any interoperability issues, if you want a signed
> byte on the C++ side just cast and you are done.
>
> Motl wrote:
>> I do agree 'unsigned' is much more suitable for 'byte'. But the problem
>> here
>> is that we can't have Java-to-C++ interoperability if we leave different
>> signedness for 'byte'. If it's not critical, okay.
>>
>>
>> Hiram Chirino wrote:
>>
>>> I vote keep it unsigned. Signed bytes in Java were a mistake IMO.
>>> Almost every time I have to work with bytes in Java I have to do the
>>> "& 0xFF" tricks to turn it unsigned.
>>>
>>> Regards,
>>> Hiram
>>>
>>> On 5/25/07, Motl <mo...@orcsoftware.com> wrote:
>>>
>>>> At the moment, 'unsigned char' is used for BytesMessage representation
>>>> in
>>>> C++, whereas signed char is used in Java, that means the same message
>>>> will
>>>> be encoded differently in Java and C++! I agree that 'unsigned char'
>>>> (or,
>>>> precisely, uint8_t) is more suitable for 'byte' type in C/C++, but if
>>>> we
>>>> follow JMS standard, we should use 'signed char' instead. The
>>>> representation
>>>> of signed chars isn't a part of ANSI C Standard, but most compilers use
>>>> 2's
>>>> complement, and so Java does.
>>>> Hereby, I propose to replace unsigned char with signed one.
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/char-signedness-tf3814717s2354.html#a10798606
>>>> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
>>>>
>>>>
>>>>
>>> --
>>> Regards,
>>> Hiram
>>>
>>> Blog: http://hiramchirino.com
>>>
>>>
>>>
>>
>>
>
>
>
--
View this message in context: http://www.nabble.com/char-signedness-tf3814717s2354.html#a11028214
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
Re: char signedness
Posted by Timothy Bish <ta...@twcny.rr.com>.
There really isn't any interoperability issues, if you want a signed
byte on the C++ side just cast and you are done.
Motl wrote:
> I do agree 'unsigned' is much more suitable for 'byte'. But the problem here
> is that we can't have Java-to-C++ interoperability if we leave different
> signedness for 'byte'. If it's not critical, okay.
>
>
> Hiram Chirino wrote:
>
>> I vote keep it unsigned. Signed bytes in Java were a mistake IMO.
>> Almost every time I have to work with bytes in Java I have to do the
>> "& 0xFF" tricks to turn it unsigned.
>>
>> Regards,
>> Hiram
>>
>> On 5/25/07, Motl <mo...@orcsoftware.com> wrote:
>>
>>> At the moment, 'unsigned char' is used for BytesMessage representation in
>>> C++, whereas signed char is used in Java, that means the same message
>>> will
>>> be encoded differently in Java and C++! I agree that 'unsigned char' (or,
>>> precisely, uint8_t) is more suitable for 'byte' type in C/C++, but if we
>>> follow JMS standard, we should use 'signed char' instead. The
>>> representation
>>> of signed chars isn't a part of ANSI C Standard, but most compilers use
>>> 2's
>>> complement, and so Java does.
>>> Hereby, I propose to replace unsigned char with signed one.
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/char-signedness-tf3814717s2354.html#a10798606
>>> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
>>>
>>>
>>>
>> --
>> Regards,
>> Hiram
>>
>> Blog: http://hiramchirino.com
>>
>>
>>
>
>
Re: char signedness
Posted by Motl <mo...@orcsoftware.com>.
I do agree 'unsigned' is much more suitable for 'byte'. But the problem here
is that we can't have Java-to-C++ interoperability if we leave different
signedness for 'byte'. If it's not critical, okay.
Hiram Chirino wrote:
>
> I vote keep it unsigned. Signed bytes in Java were a mistake IMO.
> Almost every time I have to work with bytes in Java I have to do the
> "& 0xFF" tricks to turn it unsigned.
>
> Regards,
> Hiram
>
> On 5/25/07, Motl <mo...@orcsoftware.com> wrote:
>>
>> At the moment, 'unsigned char' is used for BytesMessage representation in
>> C++, whereas signed char is used in Java, that means the same message
>> will
>> be encoded differently in Java and C++! I agree that 'unsigned char' (or,
>> precisely, uint8_t) is more suitable for 'byte' type in C/C++, but if we
>> follow JMS standard, we should use 'signed char' instead. The
>> representation
>> of signed chars isn't a part of ANSI C Standard, but most compilers use
>> 2's
>> complement, and so Java does.
>> Hereby, I propose to replace unsigned char with signed one.
>>
>> --
>> View this message in context:
>> http://www.nabble.com/char-signedness-tf3814717s2354.html#a10798606
>> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
>>
>>
>
>
> --
> Regards,
> Hiram
>
> Blog: http://hiramchirino.com
>
>
--
View this message in context: http://www.nabble.com/char-signedness-tf3814717s2354.html#a11027714
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.