Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion A question about the type of a non-prot
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
David M. Kristol  
View profile  
 More options Aug 11 1993, 10:15 am
Newsgroups: comp.std.c
From: d...@allegra.att.com (David M. Kristol)
Date: Wed, 11 Aug 1993 13:33:37 GMT
Local: Wed, Aug 11 1993 9:33 am
Subject: Re: A question about the type of a non-prot

In article <CBKJLx....@ibeam.intel.com> p...@cirrus.ht.intel.com (Philip Lantz) writes:
>>void foo (i) int i; { }
>>void (*p) (double i);

>>void test ()
>>{
>>    p = foo;            /* diagnostic required? */
>>}

>The fact that the standard requires a diagnostic for this astonishes
>me, even though I have followed the arguments and looked up the
>relevant sections.  I do not believe that the committee intended that a
>compiler must remember the parameter types of a function that is
>defined without a prototype.

>I believe that the paragraph of 3.5.4.3 defining compatible function
>types was written with the purpose of rendering undefined a call to a
>function via an function designator with an incompatible type.
>(Section 3.3.4 (Cast operators): "If a converted pointer is used to
>call a function that has a type that is not compatible with the type of
>the called function, the behavior is undefined.)

>I think that the fact that it also requires a diagnostic for an assignment
>was overlooked.

>Any opinions?

I implemented much of the front-end for (what is now) USL's ANSI C
compiler.  My office-mate was Dave Prosser, who was redactor for the
ANSI Standard.  He came back from a Standards meeting at some point and
told me about this addition.  I grumbled, wrung my hands, and added the
necessary code to the front-end.  The change was certainly intentional
-- they knew what they did.

I think the warning (in our case) provides a service to the user,
by warning that the types are, in fact, incompatible.  The USL
compiler does not prevent you from doing it ("The Spirit of C"),
just points out that you may be making a mistake.

Dave Kristol


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.