Re: subroutine stack and C machine model
- From: Seebs <usenet-nospam@xxxxxxxxx>
- Date: 27 Oct 2009 18:43:16 GMT
On 2009-10-27, Ben Bacarisse <ben.usenet@xxxxxxxxx> wrote:
Seebs <usenet-nospam@xxxxxxxxx> writes:
Not quite. Rather, I believe that, if you follow the syntax down far
enough, you can tell them apart, because constant values can be distinguished
from variables.
Well, to my mind, if you keep enough of the parse tree you can
distinguish a volatile qualified object from a non-qualified one which
was your canonical non-syntactic distinction.
I'm just looking at the parsing of a single expression. If you know
that a given unary-expression has at its root an integer constant, then
you know that the expression is a constant. On the other hand, there
are some things you can't tell apart -- as someone helpfully pointed
out (Keith, maybe?), you can't tell an enum value from a variable
syntactically.
It just means there is more to discuss -- for example, pinning down
some terms before moving on. What matters to a compiler is what can
be determined from the information it has, and that is clearly more
than what you choose to call syntax. I don't mind if you want to use
a very narrow meaning, and you should not object to my using a
slightly wider one. We may even have to agree on one for convenience,
but the terms we use have no effect on what can and can not be
determined about a C program.
But they have a great deal of effect on the question of what can be
determined about it *solely from its syntax*. Static analysis can do
amazing things -- e.g., lclint used to use a garbage collector, but they
did some static analysis on it and fixed all the memory leaks, so now it
doesn't need one. There exist large sets of programs for which you
can, statically, determine whether or not they can ever leak memory.
I think, to bring it vaguely back into context, the question was in the
context of whether a compiler could tell whether a given optimization would
be safe. For instance, if you have two functions which print output, and
you add their return values, can the compiler reasonably tell that their
order of execution matters? I think the general answer is probably "it's
not reasonable to expect compilers to know."
-s
--
Copyright 2009, all wrongs reversed. Peter Seebach / usenet-nospam@xxxxxxxxx
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
.
- References:
- Re: subroutine stack and C machine model
- From: Seebs
- Re: subroutine stack and C machine model
- From: spinoza1111
- Re: subroutine stack and C machine model
- From: Seebs
- Re: subroutine stack and C machine model
- From: spinoza1111
- Re: subroutine stack and C machine model
- From: Richard Heathfield
- Re: subroutine stack and C machine model
- From: spinoza1111
- Re: subroutine stack and C machine model
- From: Nick Keighley
- Re: subroutine stack and C machine model
- From: spinoza1111
- Re: subroutine stack and C machine model
- From: Richard Heathfield
- Re: subroutine stack and C machine model
- From: Seebs
- Re: subroutine stack and C machine model
- From: Ben Bacarisse
- Re: subroutine stack and C machine model
- From: Seebs
- Re: subroutine stack and C machine model
- From: Ben Bacarisse
- Re: subroutine stack and C machine model
- From: Seebs
- Re: subroutine stack and C machine model
- From: Ben Bacarisse
- Re: subroutine stack and C machine model
- From: Seebs
- Re: subroutine stack and C machine model
- From: Ben Bacarisse
- Re: subroutine stack and C machine model
- Prev by Date: Re: subroutine stack and C machine model
- Next by Date: Re: replicating Plauger's math library using gcc and ubuntu
- Previous by thread: Re: subroutine stack and C machine model
- Next by thread: Re: subroutine stack and C machine model
- Index(es):
Relevant Pages
|