Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles $Revision: 1.6.2.16 $; site ada-uts.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!ada-uts!richw From: richw@ada-uts.UUCP Newsgroups: net.lang.c Subject: Significant chars in IDs Message-ID: <10200011@ada-uts.UUCP> Date: Wed, 2-Oct-85 10:14:00 EDT Article-I.D.: ada-uts.10200011 Posted: Wed Oct 2 10:14:00 1985 Date-Received: Sat, 5-Oct-85 07:24:36 EDT Lines: 71 Nf-ID: #N:ada-uts:10200011:000:1900 Nf-From: ada-uts!richw Oct 2 10:14:00 1985 I have a simple (?) question. How many characters are significant for the following types of identifiers? I've included what Kernighan/Ritchie says for each case, but have my doubts for some (those which refer to counter-examples at the end of this note). Is it simply the case that I've got a lenient C compiler? Can anybody quote the "standard" for these cases? Thanks in advance, Rich Wagner ------------------------------------------------------------------------- External data (e.g. "int foo;" declared outside all functions) : (machine dependent according to K&R; agreed) External functions (e.g. doit() { ... }) : (machine dependent according to K&R; agreed) Data local to a file (e.g. "static int foo" declared outside functions) : (8 according to K&R, but see TEST1, which prints { 1, 2 }) Data local to a function (e.g. "int foo" declared inside a function) : (8 according to K&R, but see TEST2, which prints { 1, 2 }) Struct field names : (??? according to K&R; see TEST3, which prints { 1, 2 }) /*------------------------TEST1-----------------------*/ static int long_name_suf_1; static int long_name_suf_2; main() { long_name_suf_1 = 1; long_name_suf_2 = 2; printf("{ %d, %d }\n", long_name_suf_1, long_name_suf_2); } /*------------------------TEST2-----------------------*/ main() { int long_name_suf_1; int long_name_suf_2; long_name_suf_1 = 1; long_name_suf_2 = 2; printf("{ %d, %d }\n", long_name_suf_1, long_name_suf_2); } /*------------------------TEST3-----------------------*/ typedef struct { int long_name_suf_1; int long_name_suf_2; } pair; main() { pair obj; obj.long_name_suf_1 = 1; obj.long_name_suf_2 = 2; printf("{ %d, %d }\n", obj.long_name_suf_1, obj.long_name_suf_2); } /*----------------------------------------------------*/