9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: macro fun [Re: [9fans] plan or side effect]
@ 2002-03-18 18:05 forsyth
  2002-03-19  9:50 ` Douglas A. Gwyn
  0 siblings, 1 reply; 25+ messages in thread
From: forsyth @ 2002-03-18 18:05 UTC (permalink / raw)
  To: 9fans

sorry, i'd sent that note before yours arrived.
that's fine.   i can't tell from the gcc manual page
on FreeBSD but presumably -ansi switches off
gcc extensions of one sort or another but doesn't
check conformance.


^ permalink raw reply	[flat|nested] 25+ messages in thread
* Re: macro fun [Re: [9fans] plan or side effect]
@ 2002-03-19 10:57 forsyth
  0 siblings, 0 replies; 25+ messages in thread
From: forsyth @ 2002-03-19 10:57 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 186 bytes --]

yes, i did mean to restrict it to reasonable static analysis.
actually one can hope for more than `readily detectable
violations'--global static analysers can do a lot, even for C.


[-- Attachment #2: Type: message/rfc822, Size: 2061 bytes --]

To: 9fans@cse.psu.edu
Subject: Re: macro fun [Re: [9fans] plan or side effect]
Date: Tue, 19 Mar 2002 09:50:03 GMT
Message-ID: <3C96C3BA.CFB711B0@null.net>

forsyth@caldo.demon.co.uk wrote:
> ... presumably -ansi switches off gcc extensions of one sort
> or another but doesn't check conformance.

Checking a program for strict conformance appears to be one
of those finitely uncomputable tasks.  The best one can hope
for is that readily detectable violations are flagged.  The
C standard requires diagnostics for most of those..

^ permalink raw reply	[flat|nested] 25+ messages in thread
* Re: macro fun [Re: [9fans] plan or side effect]
@ 2002-03-18 11:22 forsyth
  2002-03-18 17:37 ` Thomas Bushnell, BSG
  0 siblings, 1 reply; 25+ messages in thread
From: forsyth @ 2002-03-18 11:22 UTC (permalink / raw)
  To: 9fans

>> according to gcc, [t.c] is strictly conforming. it compiles
> perfectly.

>That's not at all the same thing.

since he said -ansi -pendantic (or some such) i suspect he
expected it to complain, and it probably should.



^ permalink raw reply	[flat|nested] 25+ messages in thread
* Re: [9fans] plan or side effect
@ 2002-02-28 17:41 David Gordon Hogan
  2002-03-05  9:43 ` Boyd Roberts
  0 siblings, 1 reply; 25+ messages in thread
From: David Gordon Hogan @ 2002-02-28 17:41 UTC (permalink / raw)
  To: 9fans

> No, in general GCC does not have such knowledge.  
> 
> If it is able to inline the function, then of course it can do the
> optimization, but an inlined function isn't a function call at all, so
> that's really a different case.
> 
> Also, GCC has some builtin functions; it knows the behavior of those.
> But not (in general) library functions.

It certainly knows about strcpy() and memmove() (or
whatever they're #defined to in the headers).  So for
instance,

	strcpy(s, "xyzzy");

will get replaced with a bunch of instructions to store the
appropriate constant values in s.

I'm just reporting, I don't think it's a particularly good thing.
Like, do we really need that extra .1% speed improvement,
at the expense of code size, compile speed, and transparent
behaviour?

When I say .1%, I'm just pulling a number out of the air.
Clearly, if your program is composed entirely out of
strcpy's of constants, the improvement could be much
larger(!).  But, I claim that this is a pathological case,
and the time wasted on such `improvements' is generally
better spent elsewhere (like, maybe, some day, someone
will simplify the morass of #ifdefs that GCC and Binutils
are afflicted with...).



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

end of thread, other threads:[~2002-03-21 11:01 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-18 18:05 macro fun [Re: [9fans] plan or side effect] forsyth
2002-03-19  9:50 ` Douglas A. Gwyn
  -- strict thread matches above, loose matches on Subject: below --
2002-03-19 10:57 forsyth
2002-03-18 11:22 forsyth
2002-03-18 17:37 ` Thomas Bushnell, BSG
2002-02-28 17:41 [9fans] plan or side effect David Gordon Hogan
2002-03-05  9:43 ` Boyd Roberts
2002-03-08 17:30   ` Thomas Bushnell, BSG
2002-03-14  9:56     ` macro fun [Re: [9fans] plan or side effect] ozan s. yigit
2002-03-15 10:18       ` Thomas Bushnell, BSG
2002-03-15 10:18       ` Douglas A. Gwyn
2002-03-15 17:48         ` ozan s. yigit
2002-03-15 18:40           ` Mike Haertel
2002-03-18 10:38             ` ozan s yigit
2002-03-15 18:42           ` Mike Haertel
2002-03-18 10:32           ` Thomas Bushnell, BSG
2002-03-18 10:33           ` Thomas Bushnell, BSG
2002-03-21 11:01             ` ozan s yigit
2002-03-18 10:33           ` Ralph Corderoy
2002-03-19  9:49             ` Douglas A. Gwyn
2002-03-21 11:01               ` Ralph Corderoy
2002-03-18 10:38           ` AMSRL-CI-CN
2002-03-20 13:38           ` Boyd Roberts
2002-03-18 10:38         ` ozan s. yigit
2002-03-18 13:08           ` Wladimir Mutel
2002-03-19  9:49             ` ozan s. yigit
2002-03-19  9:49           ` Douglas A. Gwyn
2002-03-19 16:01             ` ozan s yigit

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 NNTP newsgroup(s).