🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #51454

Re: binary constant patch available

#51454
From: Fergus James HENDERSON
Date: Tue, 18 May 1993 13:54
53 lines
2428 bytes
dougm@cs.rice.edu (Doug Moore) writes:

>Following this message is an update of a patch (by an author whose
>name I have lost - sorry) to add binary constants of the form 0b11010
>to C and C++.  The update is really just a line number adjustment,
>reflecting changes in gcc 2.4.0.

There is a bug in this patch - it doesn't give a warning about
the feature being a gcc extenssion if I use '-pedantic'.

Here's my patch to the patch, completely untested of course :-)

>*** c-lex.c.orig	Tue May  4 11:45:19 1993
>--- c-lex.c	Mon May 17 20:48:07 1993
>***************
>*** 1306,1315 ****
>--- 1306,1328 ----
>  	if (c == '0')
>  	  {
>  	    *p++ = (c = getc (finput));
>+ 	    /* hexadecimal (base 16) representation */
>  	    if ((c == 'x') || (c == 'X'))
>  	      {
>  		base = 16;
>  		*p++ = (c = getc (finput));
>+ 	      }
>+ 	    /* binary (base 2) representation */
>+ 	    else if ((c == 'b') || (c == 'B'))
>+ 	      {

		if (pedantic)
		  pedwarn ("ANSI C forbids use of binary constants");

>+ 		base = 2;
>+ 		*p++ = (c = getc (finput));
>+ 	      }
>+ 	    /* octal rep. (base 8),  "traditional" form is defined below */
>+ 	    else if ((c == 'o') || (c == 'O'))
>+ 	      {

		if (pedantic)
		  pedwarn ("ANSI C forbids use of letter 'o' for octal constants");

>+ 		base = 8;
>+ 		*p++ = (c = getc (finput));
>  	      }
>  	    /* Leading 0 forces octal unless the 0 is the only digit.  */
>  	    else if (c >= '0' && c <= '9')
-- 
Fergus Henderson                     This .signature virus might be
fjh@munta.cs.mu.OZ.AU                getting old, but you still can't
                                     consistently believe it unless you
Linux: Choice of a GNU Generation    copy it to your own .signature file!
Technical Details
Message-ID: <9313823.24994@mulga.cs.mu.OZ.AU>
Path: arc1-ca.pugleaf.net!gmd.de!Germany.EU.net!mcsun!uunet!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
References: <9305180249.AA17378@cs.rice.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,3b1e2a88e90661eb
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-05-18 07:09:07 PST
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!gmd.de!Germany.EU.net!mcsun!uunet!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
Subject: Re: binary constant patch available
Message-ID: <9313823.24994@mulga.cs.mu.OZ.AU>
Sender: news@cs.mu.OZ.AU
Organization: Computer Science, University of Melbourne, Australia
References: <9305180249.AA17378@cs.rice.edu>
Distribution: gnu
Date: Tue, 18 May 1993 13:54:06 GMT
Lines: 53