🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #8396

Re: 'C' style etc...

#8396
From: Doug Merritt
Date: Mon, 11 Apr 1988 15:03
30 lines
2104 bytes
[ re: long character constants like "case 'REXX':" ]

>Whadda you know. Every compiler I've hit with this so far has worked just
>fine. I just assumed that it was in K&R. After all, it makes perfect sense,
>modulo byte ordering problems, so by the principle of least astonishment
>it should be there.
>
>Hey! X3J11! Here's something that should be in the standard, and that has
>prior art, and is useful. How about it?

Well, not really, although it sounds good at first...Consider that C
does not even require longs to be 32 bits. But 'REXX' definitely does
require 32 bits. Also, what you're really doing is a form of character
array packing. The principle of least astonishment does not apply here,
because the single quotes refer just to a one-character constant,
not an array. Note that K&R similarly frowns on two char constants like
'AB'; although some compilers allow it, it cannot be depended on.

If what you want is a facility for specifying packed character constants,
then the issue needs to be thought out in regard to its impact on the
language overall. It's not just a question of the original intended
usage of 'REXX'.

What people usually want is to be able to put ANYTHING in a switch
statement, and in fact a number of languages have been developed that
allow this. It just turns into syntactic-sugar for a sequence of if-
then-elses.

	Doug Merritt		doug@mica.berkeley.edu (ucbvax!mica!doug)
			or	ucbvax!unisoft!certes!doug
Technical Details
Message-ID: <8572@agate.BERKELEY.EDU>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!lll-winken!lll-lcc!lll-tis!ames!pasteur!agate!eris!doug
References: <8647@eddie.MIT.EDU> <893@nuchat.UUCP> <8449@agate.BERKELEY.EDU> <1813@sugar.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!lll-winken!lll-lcc!lll-tis!ames!pasteur!agate!eris!doug
From: doug@eris (Doug Merritt)
Newsgroups: comp.sys.amiga.tech,comp.sys.amiga,comp.lang.c
Subject: Re: 'C' style etc...
Message-ID: <8572@agate.BERKELEY.EDU>
Date: 11 Apr 88 15:03:45 GMT
References: <8647@eddie.MIT.EDU> <893@nuchat.UUCP> <8449@agate.BERKELEY.EDU> <1813@sugar.UUCP>
Sender: usenet@agate.BERKELEY.EDU
Reply-To: doug@eris.UUCP (Doug Merritt)
Organization: University of California, Berkeley
Lines: 29
Keywords: K&R, nonstandard constructs, multi-char char constsants, hashing
Summary: Not as nice as it seems at first