david@ukma.UUCP (David Herron, NPR Lover) (12/11/84)
I know! We are wanting something that says "comment till end of line" but all the suggestions so far go down in flames because that character is already in use. Is '$' really not used? Could '$$' be used to signal this type of comment? Does anybody really care? At any rate. (---Pull out random piece of C code---) Here is a C routine I wrote a long time ago. It used "regular" type comments of course. I just redid the comments for illustration purposes. ------------------>Start C (with funny comments) routine<---------------- $$ putvc.c -- Contains ctovc routine. Generates readable control characters. $$ $$ char *ctovc(c) char c; $$ Pass a character in c. The routine returns a string representing the $$ character. If the character is a non-printing character, it generates $$ the backslash-mnemonic equivalent, otherwise it returns the character. $$ char bf[6]; $$ to put \nnn in char *ctovc(c) char c; { switch(c) { case '\n': return("\\n"); $$ newline case '\t': return("\\t"); $$ tab case '\b': return("\\b"); $$ backspace case '\r': return("\\r"); $$ return case '\f': return("\\f"); $$ formfeed case '\\': return("\\\\"); $$ backslash case '\'': return("\'"); $$ single-quote default: if(c>=' ' && c<0200) sprintf(bf,"%c",c); else sprintf(bf,"\\%o",(int)c); return(bf); } } ------------------------>End C Routine<---------------------------- # could be used if people want to let *non-standard* C compilers live. Actually, the '$' is needed in some environments...... The purpose of C is to support system programmers. System programmers have to interface to the existing system. If the existing system uses symbols containing the '$' character then C needs to support them in that environment or the system programmer wont be able to call the standard system calls in the way s/he is accustomed to doing. Then there are systems where # is useful. (.....sigh....where does it stop) (One example is the dec-10. Macro-10 uses # at the end of certain symbols to tell the assembler that it needs to allocate space for it, and ## means that the symbol is external. Then the IBM PL/1-F compiler I used a few years ago accepted # as part of a symbol name, so assumably the linker takes # in a symbol.) (Are there any systems where @ couldn't be used?) (How about '`'? (grave character)). I'm going to stop before y'all get mad about all this rambling....... ----------------------------------------- David Herron; ARPA-> "ukma!david"@ANL-MCS (Note the quote marks.) UUCP-> unmvax -----------\ UUCP-> research ----------\_______ {anlams,anl-mcs} --\ UUCP-> boulder -----------/ >-!ukma!david UUCP-> decvax!ucbvax ----/ cbosgd!hasmed!qusavx --/ (The usual warning about having no opinions). "I read banned books."
henry@utzoo.UUCP (Henry Spencer) (12/14/84)
> I know! We are wanting something that says "comment till end of line" > but all the suggestions so far go down in flames because that character > is already in use. Is '$' really not used? Could '$$' be used... If you must have a comment-to-EOL convention (great stuff, but it may be a bit late to add it to C), the character(s) used to mark it preferably should be unshifted and near the home row. "//" comes much closer to this than "$$". > ... (Are there any systems where @ > couldn't be used?) Some of my reactionary :-) friends still use @ as line kill... -- Henry Spencer @ U of Toronto Zoology {allegra,ihnp4,linus,decvax}!utzoo!henry
hamilton@uiucuxc.UUCP (12/15/84)
> Then the IBM PL/1-F compiler >I used a few years ago accepted # as part of a symbol name, so assumably >the linker takes # in a symbol.) (Are there any systems where @ >couldn't be used?) pl/1 allows '@' as part of an identifier. i used to prefix all my pl/1 pointer variables that way. used to use '#' as well: "#things" as a counter, "thing#" as an index, and "#" as a generic counter/index instead of "i". wayne ({decvax,ucbvax}!pur-ee!uiucdcs!uiucuxc!)hamilton