This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Possible bug in dbg-threads-syscall.c


"Patrick Doyle" <wpd@delcomsys.com> writes:

> > > That's what makes sense to me.  So then what does:
> > >
> > > if (*int_fun_ptr == 0) blah()
> > >
> > > mean?
> > > (I know, we are way off topic here, but it does seem like a
> > bizarre thing to
> > > test).
> >
> > Frankly, no idea and I don't understand why the compiler eats it
> > without any
> > sign of sickness.
> >
> That's _exactly_ what caught me by surprise here.  The compiler thinks that
> it is a perfectly reasonable construct.  Now, I suppose it is possible that
> we have just uncovered a subtle flaw in GCC (since I have not looked at this
> on any other compilers), but I expect not., I expect that the standard
> either defines exactly what is meant by *int_fun_ptr, or states explicitly
> that it is implementation defined (more likely).  It just seemed bizarre to
> me that this would have been accepted by the compiler.  I was wondering if
> any C language purist gurus out there would step in and say "yep, on page
> 1234 of the spec, it says that while this is acceptable syntax, the
> implementation is free to do whatever it wants", or something like that.

Ok then ;-)

ISO/IEC 9899:1999 (E) 6.3.2.1 paragraph 4 says that a function designator,
in two special cases excepted, is converted to a pointer to a function.

Robin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]