Re: Pascal - C (2)
On Sun, 2 Nov 2008 12:50:11 +0000 (UTC), Harald van D?k
<truedfx@gmail. comwrote:
On EBCDIC systems, a-f are also valid hex digits. The same is true on
Solaris systems. Even in standard C, the conversion specification "x"
produces a-f while"X" produces A-F. Surely each of the characters
produced either way is a valid hex character.
--
Remove del for email
On Sun, 2 Nov 2008 12:50:11 +0000 (UTC), Harald van D?k
<truedfx@gmail. comwrote:
>On Sun, 02 Nov 2008 01:28:00 -0700, Barry Schwarz wrote:
>
>It will (after fixing 'Z' so that it reads 'F') work on ASCII end EBCDIC
>systems. In theory, there could be other systems where it will fail. I
>doubt there are any such systems in practise, though.
>On Sat, 01 Nov 2008 23:26:37 +0100, jacob navia <jacob@nospam.c om>
>wrote:
>>
>Except for the fact that it doesn't work on an EBCDIC system.
>wrote:
>>>Ruud wrote:
>>>2) In Pascal there exists the "in" function. Example:
>>>>
>>> if (c in ['A'..'F', '0'..'9']) then { c is hexadecimal }
>>>>
>>>This can be translated like:
>>>>
>>> if ( ((c >= 'A') && (c <= 'Z'))
>>> || ((c >= '0') && (c <= '9'))) .... // c is hexadecimal
>>>>
>>>I just wonder if there is a more simpler solution.
>>>
>>>That one is simple enough
>>>2) In Pascal there exists the "in" function. Example:
>>>>
>>> if (c in ['A'..'F', '0'..'9']) then { c is hexadecimal }
>>>>
>>>This can be translated like:
>>>>
>>> if ( ((c >= 'A') && (c <= 'Z'))
>>> || ((c >= '0') && (c <= '9'))) .... // c is hexadecimal
>>>>
>>>I just wonder if there is a more simpler solution.
>>>
>>>That one is simple enough
>Except for the fact that it doesn't work on an EBCDIC system.
>It will (after fixing 'Z' so that it reads 'F') work on ASCII end EBCDIC
>systems. In theory, there could be other systems where it will fail. I
>doubt there are any such systems in practise, though.
Solaris systems. Even in standard C, the conversion specification "x"
produces a-f while"X" produces A-F. Surely each of the characters
produced either way is a valid hex character.
--
Remove del for email
Comment