[net.lang.c] aesthetics of C, and the ANSI standard

bet@ecsvax.UUCP (08/03/84)

In reference to the recent notes suggesting that the ANSI committee is
screwing up badly, and we are going to have another ADA, what exactly
are you complaining about? What I have heard here is that they aren't
trying to make C different, they are attempting to define formally what
it currently is, and tighten up existing fuzziness. In particular, what
I have heard doesn't seem to violate the central spirit of C, which is
a language sufficiently simple to be able to be implemented efficiently
an almost any machine, and sufficiently expressive to be a powerful
language. Comments? What have I missed?

On an unrelated side-track: C has a concept of scope of names, and I
think I understand that. Names can be local to a function, known
throughout but local to an entire source file, or globally known across
linking. Fine. Is there any concept of "name spaces" in C? It seems to
me that these would often show up as an artifact of how a compiler is
implemented, and would add a little bit to the cleanness of C. In
particular, structure member names are, as far as the compiler is
concerned, offsets. They are recognizable by the syntactic (or is it
semantic?) surroundings -- that is name->member doesn't leave you
suspecting that member might be a variable. Is there any reason why
this shouldn't be allowed:

	struct node {
		int data;
		struct node *next;
	}

	main()
	{
		int data;
	}

I can't see any potential for ambiguity here. Why should member names
be forced to conflict with variable names?

					Bennett Todd
					...{decvax,ihnp4,akgua}!mcnc!ecsvax!bet

jrv@mitre-bedford.ARPA (08/24/84)

It also seems to me that LABEL names could overlap variable names without
confusing the compiler.  (Whether it would confuse the casual reader is
another question.)     - Jim Van Zandt

jack@vu44.UUCP (Jack Jansen) (08/28/84)

> It also seems to me that LABEL names could overlap variable names without
> confusing the compiler.  (Whether it would confuse the casual reader is
> another question.)     - Jim Van Zandt
> 
> 
It *does* confuse the compiler. You can take the address of a label
using "&foo".
 By the way, is there anything useful you can do with this feature?
Use it as a function address? Assigned goto's??? Something else?????

	Jack Jansen, {philabs|decvax}!mcvax!vu44!jack

chip@t4test.UUCP (Chip Rosenthal) (09/03/84)

--- REFERENCED ARTICLE ---------------------------------------------

>Subject: Re: aesthetics of C, and the ANSI standard
>From: jack@vu44.UUCP (Jack Jansen)
>
>It *does* confuse the compiler. You can take the address of a label
>using "&foo".
> By the way, is there anything useful you can do with this feature?
>Use it as a function address? Assigned goto's??? Something else?????

--------------------------------------------------------------------

Sure you can!  You can write programs which have self modifying
code!!

-- 

Chip Rosenthal, Intel/Santa Clara
{ idi|intelca|icalqa|kremvax|qubix|ucscc } ! t4test ! { chip|news }

bsa@ncoast.UUCP (The WITNESS) (09/05/84)

[gollum :-)]

> From: chip@t4test.UUCP (Chip Rosenthal)

> >It *does* confuse the compiler. You can take the address of a label
> >using "&foo".
> > By the way, is there anything useful you can do with this feature?
> >Use it as a function address? Assigned goto's??? Something else?????

> Sure you can!  You can write programs which have self modifying
> code!!

I've already done that, WITHOUT using labels:

char *myptr, myarray[5];

gobble() {
	myarray[50] = 0x0;
}

which is usually good for a core dump :-)

--bsa