home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!crdgw1!rdsunx.crd.ge.com!bart!volpe
- From: volpe@bart.NoSubdomain.NoDomain (Christopher R Volpe)
- Newsgroups: comp.lang.c
- Subject: Re: Print #define
- Message-ID: <1992Sep10.143618.3126@crd.ge.com>
- Date: 10 Sep 92 14:36:18 GMT
- References: <1992Aug26.124652.9509@alw.nih.gov> <DeqcqB1w165w@bluemoon.rn.com> <1992Sep9.152715.8286@us-es.sel.de> <1992Sep9.172812.4462@organpipe.uug.arizona.edu>
- Sender: volpe@bart (Christopher R Volpe)
- Reply-To: volpe@ausable.crd.ge.com
- Organization: GE Corporate Research & Development
- Lines: 30
- Nntp-Posting-Host: bart.crd.ge.com
-
- In article <1992Sep9.172812.4462@organpipe.uug.arizona.edu>, dave@cs.arizona.edu (Dave Schaumann) writes:
- |> In article <1992Sep9.152715.8286@us-es.sel.de>, lisa@us-es (Lisa Goulet) writes:
- |> >In K&R C, is there a way to print a preprocessor variable?
- |> >e.g. With the following define
- |> >
- |> > #define Architecture hp300
- |> >
- |> > to be able to print the "hp300" part.
- |>
- |> If you mean string-izing tokens ala ANSI C's `#' operator, ther is no
- |> portable way to do it. You could try this:
- |>
- |> #define stringize( x ) "x"
-
- This does not have the desired effect on any of the old-style compilers
- I'm aware of. The result of `stringize(Architecture)' would be
- `"Architecture"', not `"hp300"'.
-
- |>
- |> Many K&R preprocessors used this as an "undocumented feature" to stringize
- |> tokens.
- |>
- |> --
- |> Dave Schaumann dave@cs.arizona.edu
-
- --
- ==================
- Chris Volpe
- G.E. Corporate R&D
- volpecr@crd.ge.com
-