#define kinda stuff

AAAARRRRGGGGv argv at sri-spam.ARPA
Fri Apr 11 17:35:22 AEST 1986


In article <1458 at cwruecmp.UUCP> ryan at cwruecmp.UUCP (Ryan McGuire) writes:
>    Here's what I wanna do:
>
>#define (-: /*
>#define :-) */

As we all know, this is not possible, however someone around here
tried it and found a strange compiler error: "endif not found"
Code was:

#define \(-: "/*"
#define :-\) "*/"

(-: comment :-)
main(){}

Well, *I* thought it was a compiler error since there was no "if"
for the preprocessor!

Something a little more interesting, tho, is that the following code,
submitted by someone learning C on the Sun:

char foo[3][10] = { "one"; "two"; "three"; };
main()
{
    printf("%s\n", foo[1]);
}

crashes the C compiler with a segmentation violation (sun only)!  Oh, it
recognizes the syntax error, but as soon as it tries to do something
with the printf statement, it barfs with a seggie!  Strange...

dan (argv at sri-spam.arpa)



More information about the Comp.unix.wizards mailing list