From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,976f7334973592b2 X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2001-07-13 10:50:54 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!paloalto-snf1.gtei.net!news.gtei.net!news.compaq.com!news.cpqcorp.net!not-for-mail From: Newsgroups: comp.unix.tru64 References: <9il0pr$6b8$1@news.ndsu.nodak.edu> Subject: Re: question about particular ptrmismatch warning X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 Message-ID: <1yG37.698$rc5.47673@news.cpqcorp.net> Date: Fri, 13 Jul 2001 13:50:24 -0400 NNTP-Posting-Host: 16.28.0.211 X-Complaints-To: abuse@Compaq.com X-Trace: news.cpqcorp.net 995046653 16.28.0.211 (Fri, 13 Jul 2001 10:50:53 PDT) NNTP-Posting-Date: Fri, 13 Jul 2001 10:50:53 PDT Organization: Compaq Computer Corporation Xref: archiver1.google.com comp.unix.tru64:3493 "Tim Mooney" wrote in message news:9il0pr$6b8$1@news.ndsu.nodak.edu... > > cc -DHAVE_CONFIG_H -I. -I. -I. -std1 -O2 -g3 -tune host -arch host -portable > -readonly_strings -msg_disable inlinestoclsmod,valuepres -c ltdl.c -DPIC > > *why* does the compiler generate an Info message regarding the assignment > above (and subsequent Warning messages about ptrmismatch when func is > used later): > > cc: Info: ltdl.c, line 2557: In the initializer for func, "data1" of type > "pointer to void", is being converted to "pointer to function (pointer to > const char, pointer to void) returning int". Such a cast is not permitted by > the standard. (nonstandcast) > = (int (*) LT_PARAMS((const char *filename, lt_ptr data))) data1; > -------------------------------------------------------------------^ > The compiler emits the message because you specified -portable on the command line. This tells the compiler to emit diagnositics for constructs that may not be accepted by other compilers. Because this cast violates the C standard, other compilers may not accept it. > It's nice that it says that `Such a cast is not permitted by the standard.', > but I'm left wondering what the real problem is. The standard only permits casts between pointers to object or incomplete types and other pointers to object or incomplete types, or between pointers to function types. One can not cast a pointer to void (an incomplete type) to a pointer to a function type (as you are doing). I don't want to guess why the standard does not allow this. Maybe you could ask in comp.lang.c. Note that if you would like more information on any compiler message, add the -verbose switch to the command line. This will cause additional information to be output for each message. Hope this helps, Ed Vogel Compaq C Engineering.