public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jay <jayk123@hotmail.com>
To: <gcc-help@gcc.gnu.org>, <reza@parvan.net>, <ext@sidvind.com>
Subject: RE: inconsistent macro behavior
Date: Mon, 28 Jul 2008 08:41:00 -0000	[thread overview]
Message-ID: <COL101-W473048CFF7E045BE95748FE6830@phx.gbl> (raw)
In-Reply-To: <1217227025.3398.ezmlm@gcc.gnu.org>


  --Forwarded Message Attachment--
 >  Date: Sun, 27 Jul 2008 20:24:57 -0700
 >  ext@sidvind.com
 >  [R] reza@parvan.net
 >  To: gcc-help@gcc.gnu.org
 >  Subject: inconsistent macro behavior


[R] ... 
[R] #define x "llll 
[R] #define y " 
[R] ... 
 
 
Search the web for "preprocessor tokenization". 
 
The preprocessor is a bit strange. It resembles:
  - spec the existing (at the time) implementation(s)
  - spec something that is "reasonable" for "reasonable" "interesting' input
  - for input that is NOT "reasonable" and/or "interesting", favor existing implementation(s), even IF it doesn't make much sense
  - for input that IS "reasonable" and/or "interesting", walk a tightrope between existing implementation(s) and making sense, not always possible to do both, but often


As well, the C/C++ preprocessor is often used against other than C/C++ code, but it wasn't really designed for such, and doesn't always work well.


Microsoft Visual C++ does not like it either: 


D:\Documents and Settings\jay>type 5.c
 #define x "llll
 #define y "


D:\Documents and Settings\jay>cl -c  5.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762 for 80x86
5.c
5.c(1) : error C2001: newline in constant
5.c(2) : error C2001: newline in constant

D:\Documents and Settings\jay>cl -c -E  5.c
5.c
#line 1 "5.c"
 5.c(1) : error C2001: newline in constant
 5.c(2) : error C2001: newline in constant


 - Jay

       reply	other threads:[~2008-07-28  7:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1217227025.3398.ezmlm@gcc.gnu.org>
2008-07-28  8:41 ` Jay [this message]
2008-07-28  7:29 Reza Roboubi
2008-07-28  8:36 ` David Sveningsson
2008-07-28 12:57   ` Reza Roboubi
2008-07-28 12:28 ` Reza Roboubi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=COL101-W473048CFF7E045BE95748FE6830@phx.gbl \
    --to=jayk123@hotmail.com \
    --cc=ext@sidvind.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=reza@parvan.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).