From: Derek M Jones <derek@knosof.co.uk>
To: Al Viro <viro@ftp.linux.org.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Michael Stefaniuc <mstefani@redhat.com>,
Sparse Mailing-list <linux-sparse@vger.kernel.org>
Subject: Re: '$' as "valid" character in identifiers
Date: Thu, 24 May 2007 12:14:03 +0100 [thread overview]
Message-ID: <4655737B.7010701@knosof.co.uk> (raw)
In-Reply-To: <20070524100433.GE4095@ftp.linux.org.uk>
Al,
> The question is how do they treat $ in preprocessor tokens. Is it a full
> equivalent of letter? I.e. is $x a valid identifier? If it is, that's
> easy - all we need is to add it cclass[] in tokenize.c as a letter and be
> done with that. If not (i.e. if it can only appear after the first
> letter), we probably want to either classify it as digit or split the
> "Digit" bit in two and modify the code checking for it. In any case,
> we need to figure out what to do with
>
> #define A(x,y) x##y
> A(a,$b)
>
> Either $b is an identifier, or it would better be a valid pp-number; otherwise,
> we'll get the second argument split in two tokens and get a$ b out of that
> macro.
Item 10 of http://www.open-std.org/jtc1/sc22/wg14/www/docs/n861.htm
gives some history and possible solutions.
If an implementation supports $ in identifiers, then it is an extension.
Implementation extensions are blessed in C99 provided they don't change
the behavior of strictly conforming programs. Since $ is not in the
basic source character set a program that contains them is not strictly
conforming.
If sparse supports $ then it just has to do what the implementation it
is mimicing does. There is no C Standard behavior as such to worry about.
--
Derek M. Jones tel: +44 (0) 1252 520 667
Knowledge Software Ltd mailto:derek@knosof.co.uk
Applications Standards Conformance Testing http://www.knosof.co.uk
next prev parent reply other threads:[~2007-05-24 11:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-23 21:43 '$' as "valid" character in identifiers Michael Stefaniuc
2007-05-23 22:00 ` Michael Stefaniuc
2007-05-23 22:10 ` Linus Torvalds
2007-05-24 10:04 ` Al Viro
2007-05-24 11:14 ` Derek M Jones [this message]
2007-05-24 12:35 ` Al Viro
2007-05-24 13:18 ` Derek M Jones
2007-05-24 14:10 ` Al Viro
2007-05-24 14:43 ` Derek M Jones
2007-05-24 14:50 ` Michael Stefaniuc
2007-05-24 14:26 ` Neil Booth
2007-05-24 14:35 ` Neil Booth
2007-05-24 14:36 ` Neil Booth
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=4655737B.7010701@knosof.co.uk \
--to=derek@knosof.co.uk \
--cc=linux-sparse@vger.kernel.org \
--cc=mstefani@redhat.com \
--cc=torvalds@linux-foundation.org \
--cc=viro@ftp.linux.org.uk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.