Re: void pointer
- From: Ben Bacarisse <ben.usenet@xxxxxxxxx>
- Date: Fri, 03 Oct 2008 11:41:10 +0100
Nick Keighley <nick_keighley_nospam@xxxxxxxxxxx> writes:
On 2 Oct, 12:27, Ben Bacarisse <ben.use...@xxxxxxxxx> wrote:<snip>
Nick Keighley <nick_keighley_nos...@xxxxxxxxxxx> writes:
On 2 Oct, 10:45, Richard Heathfield <r...@xxxxxxxxxxxxxxx> wrote:
Nick Keighley said:
Is this a strictly conforming program?
int main (void)
{
int fortran = 1;
int asm = 2;
return 0;
}
Yes.
if it is then certain common extensions will break it.
Not necessarily. An implementation that offers fortran and asm as keywords
might nevertheless be "bright" enough to recognise such situations and
deal with them appropriately.
I think your "bright enough" compiler would be a candidate for
passing the Turing test.
Do you mean that the only way to disambiguate uses of a
keyword that might also be an identifier must use AI rather than
convention parsing techniques?
pretty close to, yes
If so, I disagree. It is possible to add a keyword to C that does not
interfere with it use as an identifier if the designer makes the right
language choices.
yes, but we are talking about the "Common Extensions" part of the
standard. Richard Heathfield argued that it was legitimate to cast
a function pointer to an object pointer because this appeared in
Common Extensions (which *I* call Section F.5). I argue that CEs
are not allowed in a conforming compiler precisly becuase it breaks
things. asm and fortran are keywords listed in CE.
I had missed that you were assuming a particular syntax. Section J.5
talks about fortran being a "keyword" and the asm(<string literal>);
syntax. The asm syntax looks like a function call so I can't see how
it can "break things". Not unless you also say that open() or fork()
are not allowed in a conforming compiler.
I am not talking about simply picking a keyword
that is in the implementation name-space (i.e. _Fortran). It is
possible to design the syntax so that 'fortran' is a legal identifier
but also acts like a keyword in the right context. I am not sure it
is a good idea, but it is possible.
are you sure.
Am I sure that it is possible? Yes (if I get to define all the terms!).
[I snipped your examples because they seemed to be using a particular
bad design as an argument against a general point.]
I thought my examples quite relevent. I think it is difficult
for fortran and asm to be both language words and identifiers.
Not the standard doesn't expect you to do it with other keywords.
We may be talking at cross purposes or at least be having a
definitional disagreement. If you make fortran a keyword in the
traditional sense then it is forbidden as an identifier. I did not
think this is what you meant because no amount of cleverness in the
compiler can alter this. The trick is to define the syntax so that
you can tell how the word is being used.
int main (int long, char *char[])
{
int int;
int return = 0;
for (int = 0; int < long; int++)
fortran();
return return;
}
Well, I won't snip it this time, but I don't see how a single example
helps make a case that to parse this requires AI-like cleverness in
the compiler.
--
Ben.
.
- References:
- void pointer
- From: eotcl
- Re: void pointer
- From: Nick Keighley
- Re: void pointer
- From: Richard Heathfield
- Re: void pointer
- From: Nick Keighley
- Re: void pointer
- From: Richard Heathfield
- Re: void pointer
- From: Nick Keighley
- Re: void pointer
- From: Ben Bacarisse
- Re: void pointer
- From: Nick Keighley
- void pointer
- Prev by Date: Re: input word
- Next by Date: Re: Memory allocation for an initialized character pointer;
- Previous by thread: Re: void pointer
- Next by thread: Re: void pointer
- Index(es):
Relevant Pages
|