public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Mini-patch for cccp.c
@ 1997-09-30  6:01 Thomas Koenig
  1997-09-30 23:21 ` Jeffrey A Law
  0 siblings, 1 reply; 25+ messages in thread
From: Thomas Koenig @ 1997-09-30  6:01 UTC (permalink / raw)
  To: egcs

Here's a mini-patch to cccp.c.

Rationale:

- system_header_p as char saves no space, since the struct gets padded
  anyway

- It may slow down processing infinitesimally (converting to/from int)

- using chars as Booleans are a bad idea, anyway

- This patch shuts up a spurious warning by checkergcc (which is why I
  did it in the first place)

Hope I don't have to sign a copyright assignment to the FSF for this
one-liner :-)

Tue Sep 30 14:54:55 CEST 1997  Thomas Koenig  (ig25@rz.uni-karlsruhe.de)

	* cccp.c: change system_header_p in struct file_buf to int

+++ cccp.c	Tue Sep 30 14:44:02 1997
@@ -519,7 +519,7 @@
   /* Object to be freed at end of input at this level.  */
   U_CHAR *free_ptr;
   /* True if this is a header file included using <FILENAME>.  */
-  char system_header_p;
+  int system_header_p;
 } instack[INPUT_STACK_MAX];
 
 static int last_error_tick;	   /* Incremented each time we print it.  */
-- 
Thomas Koenig, Thomas.Koenig@ciw.uni-karlsruhe.de, ig25@dkauni2.bitnet.
The joy of engineering is to find a straight line on a double
logarithmic diagram.

^ permalink raw reply	[flat|nested] 25+ messages in thread
[parent not found: <no.id>]
* Re: Mini-patch for cccp.c
@ 1997-10-01 11:08 Peter Seebach
  1997-10-01 11:14 ` Joe Buck
  1997-10-01 12:17 ` Chip Salzenberg
  0 siblings, 2 replies; 25+ messages in thread
From: Peter Seebach @ 1997-10-01 11:08 UTC (permalink / raw)
  To: egcs

Chip Salzenberg          - a.k.a. -           <chip@pobox.com> writes:
>According to Thomas Koenig:
>> To use a char in such circumstances appears to me very, very unclean.

>Your intuition needs training, then.  In C, char is just tinyint.
>Pretending otherwise is foolish.

char is actually a very awkward integer type; you can't even be sure whether
it's signed or unsigned, and it has a lot of additional aliasing baggage
and properties.  We do not recommend that it be used for anything other than
aliasing and characters.  *sigh*.

The best way to bool in C9X will probably be 'bool'.  :)

-s


^ permalink raw reply	[flat|nested] 25+ messages in thread
* Re: Mini-patch for cccp.c
@ 1997-10-06 18:10 Kaveh R. Ghazi
  1997-10-07  3:48 ` Andreas Schwab
  1997-10-07 11:41 ` Jeffrey A Law
  0 siblings, 2 replies; 25+ messages in thread
From: Kaveh R. Ghazi @ 1997-10-06 18:10 UTC (permalink / raw)
  To: Thomas.Koenig, egcs

 > Tue Sep 30 16:50:55 CEST 1997  Thomas Koenig  (ig25@rz.uni-karlsruhe.de)
 > 
 > 	* cccp.c: 
 >           (expand_to_temp_buffer) initialize all members of obuf

	Having to remember to init structure members when new ones are
added is prone to error.  Isn't it better to do bzero(&foo, sizeof(foo))
and then set any non zero members?
--
Kaveh R. Ghazi				Project Manager
ghazi@caip.rutgers.edu			ICon CMT Corp.

^ permalink raw reply	[flat|nested] 25+ messages in thread
* Re: Mini-patch for cccp.c
@ 1997-10-08 14:14 meissner
  0 siblings, 0 replies; 25+ messages in thread
From: meissner @ 1997-10-08 14:14 UTC (permalink / raw)
  To: kiskra, schwab; +Cc: egcs

| 
| On 7 Oct 1997, Andreas Schwab wrote:
| 
| > |> 	Having to remember to init structure members when new ones are
| > |> added is prone to error.  Isn't it better to do bzero(&foo, sizeof(foo))
| > |> and then set any non zero members?
| > Pedantically this won't work for pointers in the structure, ie. they still
| > have to be initialized explicitly.
| 
| Do you mean machines where the machine representation of NULL-addresses
| has some bits set? I wonder if GCC supports such machines at all?

Yes there have been machines out there that at least comptemplated making NULL
have non-zero bits (I know I at least flirted with it on the Data General
MV/Eclipse computers but never did, the PR1ME, Livermore S1, and Symbolics
computers come to mind as machines that had a non-zero NULL pointer).  No, GCC
would never run on those machines.

GCC makes a number of simplifying assumptions about the machines it generates
code for, such as all pointers are the same size and format (though I recently
did a port for a machine that had two different formats, and I had to not
implement certain things like trampolines and labels as values because of it --
it wasn't pretty).

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~1997-10-08 21:19 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-09-30  6:01 Mini-patch for cccp.c Thomas Koenig
1997-09-30 23:21 ` Jeffrey A Law
1997-10-01  2:43   ` Thomas Koenig
1997-10-01  7:07     ` Paul Koning
1997-10-01  8:36       ` Thomas Koenig
1997-10-01  9:36         ` Chip Salzenberg
1997-10-01 12:02           ` Lee Iverson
1997-10-01 12:17             ` Chip Salzenberg
1997-10-06 16:43             ` Jeffrey A Law
1997-10-06 17:13               ` John Carr
1997-10-06 17:47                 ` Jeffrey A Law
1997-10-06 16:49         ` Jeffrey A Law
1997-10-06 16:30     ` Jeffrey A Law
     [not found] <no.id>
1997-09-30  8:09 ` Thomas Koenig
1997-09-30 23:24   ` Jeffrey A Law
1997-10-06  8:25   ` Thomas Koenig
1997-10-01 11:08 Peter Seebach
1997-10-01 11:14 ` Joe Buck
1997-10-01 12:17 ` Chip Salzenberg
1997-10-06 18:10 Kaveh R. Ghazi
1997-10-07  3:48 ` Andreas Schwab
1997-10-08  2:55   ` Kamil Iskra
1997-10-08 21:19     ` Joern Rennecke
1997-10-07 11:41 ` Jeffrey A Law
1997-10-08 14:14 meissner

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).