'C' style etc...

Peter da Silva peter at sugar.UUCP
Thu Apr 14 21:33:47 AEST 1988


In article <2563 at geac.UUCP>, daveb at geac.UUCP writes:
> I said...
> > >			case 'REXX':

> > ... makes perfect sense, modulo byte ordering problems,
> > so by the principle of least astonishment it should be there.

>   Well, it works IFF you have 4-byte words, or a good promotion
> mechanism to make 'REXX' turn into a long automagically (some do).

Well, that's what I'm suggesting be added to ANSI. After all, they're adding
lots of stuff that's even less likely to be useful.

Basically, make 'chars' map unto an unsigned integer of length necessary
to fit that many characters into. The maximum would depend on how many
characters you can fit into the longest long. On machines like the Cray
that'd be 8 characters.

>   It truncates on many 16-bit machines... including one old
> pdp-11 I remember fondly.

I never tried case 'ABCD' on a pdp-11, but I found case 'AB' quite
useful.

>   If you want something humorous, try using case `REXX` (notice the
> quotes) on a machine using an old copy of PCC: It tries to generate
> BCD for a GCOS 3 machine.

That's a neat idea. That's something else that would be useful when dealing
with machines like Spermys and Control Data boxes that have weird charset
sizes: `xxx` means xxx in the native character set, for cases where ANSI
is supported but not the lowest common denominator. On the PDP-11 that would
be RAD-50 :->. Sort of like the Fortran 4 plus notation "6RMCP..." :->.

> --dave (prior art, yes. yucko, though) c-b

For 'C'-as-structured-assembly-weenies it's totally k00l :->.
-- 
-- Peter da Silva      `-_-'      ...!hoptoad!academ!uhnix1!sugar!peter
-- "Have you hugged your U wolf today?" ...!bellcore!tness1!sugar!peter
-- Disclaimer: These aren't mere opinions, these are *values*.



More information about the Comp.lang.c mailing list