home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: sparky!uunet!spool.mu.edu!darwin.sura.net!gatech!concert!sas!mozart.unx.sas.com!walker
- From: walker@twix.unx.sas.com (Doug Walker)
- Subject: Re: wierd sas/c bug
- Originator: walker@twix.unx.sas.com
- Sender: news@unx.sas.com (Noter of Newsworthy Events)
- Message-ID: <Bznxuv.InB@unx.sas.com>
- Date: Tue, 22 Dec 1992 13:37:43 GMT
- References: <BzIw0y.n31@ccu.umanitoba.ca> <BzM6F7.E6K@unx.sas.com> <BzMGn8.370@ccu.umanitoba.ca>
- Nntp-Posting-Host: twix.unx.sas.com
- Organization: SAS Institute Inc.
- Lines: 50
-
-
- In article <BzMGn8.370@ccu.umanitoba.ca>, umfehr06@ccu.umanitoba.ca (John Fehr) writes:
- |> OK... here's a compilable example: (hopefully I'll type it in right this
- |> time. :)
- |>
- |> #include <stdio.h>
- |> #undef WHATEVER "test"
- |>
- |> char dummy[100]="another test";
- |>
- |> main() {
- |> printf("dummy='%s'\n",dummy);
- |> }
-
- Aha! This is very different from what you originally posted.
-
- Here's what is happening: whenever the tokenizer sees a quoted
- string, it has to "remember" that it saw it, in case the next
- non-preprocessor non-comment token is also a quoted string.
- The expression parser knows when to "erase" the last quoted
- string seen. In your case, the expression parser isn't being
- called because it's an error case - there isn't supposed to be
- anything after the thing being #undef'd, so the error case code
- just eats tokens until the newline. Unfortunately, it doesn't
- "erase" the string token, so the next quoted string gets
- concatenated to the first one.
-
- The workaround is: don't do that! Comment out the quoted string
- on the #undef statement or something. I've already fixed it in
- the source base, but who knows when that will percolate out to
- a release - I doubt if it will make 6.2 since that is already frozen.
-
- |> I know that #undef WHATEVER "test" isn't ANSI-compliant (the HP-compiler
- |> complanes about it anyway) but some programs actually have that in
- |> their code.
-
- What the heck does it mean? This doesn't mean anything in K&R dialects
- either, as far as I know.
-
- |> - John Fehr - DoD#505 -
-
- --
- *****
- =*|_o_o|\\=====Doug Walker, Software Distiller====== BBS: (919)460-7430 =
- *|. o.| || 1200/2400/9600 Dual
- | o |// For all you do, this bug's for you!
- ======
- usenet: walker@unx.sas.com bix: djwalker
- Any opinions expressed are mine, not those of SAS Institute, Inc.
-
-