🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

2 total messages Started by Steve Hosgood Fri, 09 Sep 1988 11:22
Query about typedef type-checking
#5355
Author: Steve Hosgood
Date: Fri, 09 Sep 1988 11:22
39 lines
1710 bytes
Sorry to have to post this, it's a fairly trivial question I know, but I
don't have a copy of the proposed ANSI spec.

Put simply, does the upcoming standard intend to enforce (or warn about)
mixing 'typedef'-ed types even if the fundamental items 'beneath' the typedefs
are the same?

Specifically, if you have the following:

void fred(long *);

typedef long funny_t;

main()
{
	funny_t a;

	fred(&a);
	....
}

..will the compilers barf, or produce a warning or what?
Obviously, the code itself is perfectly runnable, and portable, as long as
the typedef of 'funny' continues to be a 'long'.

I'd like to see a warning here - am I alone?
Am I going to be dissapointed?
Thanks in advance.

Please E-mail, I'll summarise.

-----------------------------------------------+------------------------------
Steve Hosgood BSc,                             | Phone (+44) 792 295213
Image Processing and Systems Engineer,         | Fax (+44) 792 295532
Institute for Industrial Information Techology,| Telex 48149
Innovation Centre, University of Wales, +------+ JANET: iiit-sh@uk.ac.swan.pyr
Swansea SA2 8PP                         | UUCP: ..!ukc!cybaswan.UUCP!iiit-sh
----------------------------------------+-------------------------------------
            My views are not necessarily those of my employers!
Re: Query about typedef type-checking
#5357
Author: Larry Jones
Date: Thu, 15 Sep 1988 22:32
16 lines
1182 bytes
In article <74@cybaswan.UUCP>, iiit-sh@cybaswan.UUCP (Steve Hosgood) writes:
> Put simply, does the upcoming standard intend to enforce (or warn about)
> mixing 'typedef'-ed types even if the fundamental items 'beneath' the typedefs
> are the same?

No, the draft maintains the K&R interpretation that typedef does not create a
new type, merely a different way to specify an existing type.  Warnings are
not considered to be in the scope of a standard - if you'd like one, bother
your compiler vendor enough to convince them to add it.

----
Larry Jones                         UUCP: uunet!sdrc!scjones
SDRC                                      scjones@sdrc.uucp
2000 Eastman Dr.                    BIX:  ltl
Milford, OH  45150                  AT&T: (513) 576-2070
"Save the Quayles" - Mark Russell
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads