public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Frank Klemm <pfk@fuchs.offl.uni-jena.de>
To: gcc@gcc.gnu.org
Subject: Re: Proposal
Date: Thu, 27 Sep 2001 07:09:00 -0000	[thread overview]
Message-ID: <20010927160755.D330@fuchs.offl.uni-jena.de> (raw)
In-Reply-To: <orpu8dyrmj.fsf@localhost.localdomain>

On Thu, Sep 27, 2001 at 05:17:40AM -0300, Alexandre Oliva wrote:
> On Sep 17, 2001, Frank Klemm <pfk@fuchs.offl.uni-jena.de> 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 <stdio.h>

#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

  reply	other threads:[~2001-09-27  7:09 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-15 11:45 Proposal Frank Klemm
2001-09-15 12:15 ` Proposal Gerald Pfeifer
2001-09-17 16:00 ` Proposal Neil Booth
2001-09-18  2:30   ` Proposal Joseph S. Myers
2001-09-18 10:21     ` Proposal Zack Weinberg
2001-09-18 11:14       ` Proposal Joseph S. Myers
2001-09-18 22:20         ` Proposal Zack Weinberg
2001-09-19  1:14           ` Proposal Joseph S. Myers
2001-09-18 12:23       ` Proposal Frank Klemm
2001-09-18 22:37         ` Proposal Zack Weinberg
2001-09-19  0:02           ` Proposal Neil Booth
2001-09-19  2:23             ` Proposal Tim Hollebeek
2001-09-19  2:41               ` Proposal Richard Earnshaw
2001-09-19 13:38         ` Proposal Joe Buck
2001-09-18 15:35       ` Proposal Robert Lipe
2001-09-18 16:59         ` Proposal Russ Allbery
2001-09-20 11:17           ` Proposal Kai Henningsen
2001-09-20 12:34             ` Proposal Russ Allbery
2001-09-18  9:48   ` Proposal Frank Klemm
2001-09-18 11:06     ` Proposal Neil Booth
2001-09-18 11:37     ` Proposal Kevin Handy
2001-09-18 15:48       ` Proposal Neil Booth
2001-09-18 15:55         ` Proposal Toon Moene
2001-09-27  5:39     ` Proposal Alexandre Oliva
2001-09-27  7:09       ` Frank Klemm [this message]
2001-09-27 16:22         ` Proposal Zack Weinberg
2001-09-29 15:45           ` Proposal Frank Klemm
2001-09-30  9:35             ` Proposal Zack Weinberg
2001-09-27 16:36         ` Proposal Neil Booth
2001-09-29 15:45           ` Proposal Frank Klemm
2001-09-29 17:22             ` Proposal Daniel Jacobowitz
2001-09-29 18:32               ` OT: Proposal Michael Matz
2001-10-03  3:52         ` Proposal Fergus Henderson
2001-09-17  8:55 Proposal Thomas R. Truscott
2001-09-18  9:32 Proposal dewar
2001-09-18 12:30 Proposal dewar
2001-09-18 23:01 ` Proposal Zack Weinberg
2001-09-19  0:06 Proposal dewar
2001-09-19  2:34 Proposal dewar
2001-09-19  2:44 Proposal dewar
2012-09-03 15:16 Proposal Afeez Basit
2012-09-03 18:35 Proposal Afeez Basit
2013-06-26 17:41 Proposal Barrister David Lopez Esq
2013-06-26 18:15 ` Proposal Paolo Carlini
2013-06-26 18:40   ` Proposal Daniel Santos
2013-06-26 17:47 Proposal Barrister David Lopez Esq

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=20010927160755.D330@fuchs.offl.uni-jena.de \
    --to=pfk@fuchs.offl.uni-jena.de \
    --cc=gcc@gcc.gnu.org \
    /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).