Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!decwrl!mcnc!ecsgate!ecsvax!urjlew From: urjlew@uncecs.edu (Rostyk Lewyckyj) Newsgroups: comp.sys.amiga.programmer Subject: Re: Compiler code (was a flame fest) Message-ID: <1991Apr16.001748.26530@uncecs.edu> Date: 16 Apr 91 00:17:48 GMT References: <1991Apr2.100807.13471@ux1.cso.uiuc.edu> Organization: UNC Educational Computing Service Lines: 39 In article , mwm@pa.dec.com (Mike (My Watch Has Windows) Meyer) writes: > In article <1991Apr2.100807.13471@ux1.cso.uiuc.edu> cs326ag@ux1.cso.uiuc.edu (Loren J. Rittle) writes: > > In article <1991Apr2.002631.22799@mintaka.lcs.mit.edu> rjc@geech.gnu.ai.mit.edu (Ray Cromwell) writes: > >In article mykes@amiga0.SF-Bay.ORG (Mike Schwartz) writes: > >>>char buf[20]; > >>>main() > >>>{ > >>> char *d=(char *)&buf; > >>> const char *s="This is a test\n"; > >>> while(*s) { *d++=*s++; } > >>>} > void main (void) > { > char *d = (char *)&buf; > char *s = "This is a test\n"; // Note I got rid of the const, as > // not only is it of questionable > // legality under ANSI C (YOU CHANGE THE > // VALUE OF s!), but also caused SAS/C > // to generate (good, but) strange > // (meaning LONG) code. > > while (*s) > *d++=*s++; > } > > Actually, the code is perfectly valid. S is declared as a "pointer to > constant", which it is - the string isn't changed. To declare s as a > constant, its "char *const s". That would have been invalid. This probably belongs in comp.lang.c, but since C is the official Amiga language, I post my comment here. If a language causes this much controversy in just a variable/constant declaration, and does not define any specific order for evaluations, and does not have all the arithmetic operators (e.g. power), and does not have a computed go to (for branch tables) .... How can it have such a zealous cult following of true believers? How is it that an glorified assembler for the DEC PDP 11 has become the language of choice for assembler hating CS students?