Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site ucbvax.BERKELEY.EDU
Path: utzoo!linus!philabs!cmcl2!seismo!lll-crg!ucdavis!ucbvax!wisdom.BITNET!mike
From: mike@WISDOM.BITNET (Mike Trachtman)
Newsgroups: net.unix-wizards
Subject: Is this correct action for the c compiler/preprocessor ??
Message-ID: <8510301207.AA27158@ucbvax.berkeley.edu>
Date: Wed, 30-Oct-85 07:07:55 EST
Article-I.D.: ucbvax.8510301207.AA27158
Posted: Wed Oct 30 07:07:55 1985
Date-Received: Fri, 1-Nov-85 02:37:44 EST
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: University of California at Berkeley
Lines: 44


Consider the folowing short program.

#define BAD_SEGMENT     29
#define ERROR(number)   printf("Error number %d\n",number);

main() {
        /* typically there would be here some condition test
        if (somthing)
        */

        ERROR(BAD_SEGMENT);
}

what should this program do ????


On the compilers I have tried it, (vax 4.2, Vms C, Sun 2.0),
it has output of:

Error BAD_SEGMENT 29

rather than

Error number 29

which I would have expected.

Is this correct ???

I would think that anything inside double quotes is protected
from any/all substitution, and that the preprocessor, would
not do the parameter replacement.

Mike

                                Mike Trachtman
My address:

        mike@wisdom                             (BITNET)
        mike%wisdom.bitnet@wiscvm.ARPA          (ARPA/CSNET)
        mike%wisdom.bitnet@berkley              (ARPA/CSNET)
and if all else fails (ONLY for VERY short items)
        ...!decvax!humus!wisdom!mike            (UUCP)