From mboxrd@z Thu Jan 1 00:00:00 1970 From: Frank Klemm To: gcc@gcc.gnu.org Subject: Re: Proposal Date: Thu, 27 Sep 2001 07:09:00 -0000 Message-id: <20010927160755.D330@fuchs.offl.uni-jena.de> References: <200109151841.UAA04064@fuchs.offl.uni-jena.de> <20010917235928.A11347@daikokuya.demon.co.uk> <20010918021527.A14623@fuchs.offl.uni-jena.de> X-SW-Source: 2001-09/msg01093.html On Thu, Sep 27, 2001 at 05:17:40AM -0300, Alexandre Oliva wrote: > On Sep 17, 2001, Frank Klemm wrote: > > > For instance try to convert > > > #define MILLION MY_MERGE_5 ( 1, _, 000, _, 000 ) > > If you're going down this road, I'd rather just do > > #define MILLION MERGE3(1, 000, 000) > > where > > #define MERGE3(a,b,c) a##b##c > Everyone misinterprets this example. This is not an example to write 'grouped' numbers. It is an example what must be forbidden to be able to write a filter program which removes '_' from numbers. '_' should be allowed in numbers. It is allowed between the digits of numbers in a C/C++ source _before_ preprocessing. It is not allowed between digits which are 'created' during the preprocessor phase. It is nearly impossible to write a filter which recognizes such '_' and removes it. This is the reason for this rule. If gcc introduces a '_' in numbers, such a filter is a MUST. Exercise: Write a program which translates the following C_99 program to C99: ------------------------------------------------------------------------ #include #define MY_MERGE_5(a,b,c,d,e) a##b##c##d##e #define MILLION MY_MERGE_5 ( 1, _, 000, _, 000 ) #define BILLION MY_MERGE_5 ( MILLION, _, 000, _, 000 ) // UK notation #define VAR MY_MERGE_5 ( a, _, b, _, c ) #define VAR2 MY_MERGE_5 ( a, b, c, d, e ) int main ( void ) { int abc = MILLION; int VAR = MILLION; long long x = BILLION; int VAR2 = MILLION; printf ("%d %d %lld %d %d\n", abc, VAR, x, VAR2, abcde ); printf ("1000000 1000000 1000000000000 1000000 1000000\n" ); return 0; } ----------------------------------------------------------------------- -- Frank Klemm