This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC 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: converting function pointers to/from object pointers


On 24 August 2015 at 20:33, Josef Wolf wrote:
> On Mo, Aug 24, 2015 at 10:23:20 -0500, Segher Boessenkool wrote:
>> On Mon, Aug 24, 2015 at 03:53:54PM +0100, Jonathan Wakely wrote:
>> > On 24 August 2015 at 15:49, Josef Wolf wrote:
>
>> > > I have some old code, which worked fine with old GCC releases, but
>> > > fails with current GCC.
>> > >
>> > > With current GCC, I get a warning:
>> > >
>> > >     "ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]"
>> > >
>> > > and the system crashes.
>> >
>> > That warning is not likely to be the reason it crashes.
>
> Right. But warnings tend to be there for a reason. So I'm trying to find out
> how to correctly handle this situation.

It's a -Wpedantic warning telling you that you're relying on a
non-portable feature, but it's a feature that GCC supports, so is not
indicative of an actual problem.

It's like using 'long long' in C90 mode, it is not strictly valid
according to the ISO C90 standard, but that doesn't mean the program
will crash when it tries to use 'long long'.

If you don't want such warnings then don't use -Wpedantic.

It's not the reason for the crash.


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