Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Keith Thompson <kst-u@mib.org> |
| Newsgroups | comp.lang.c |
| Subject | Re: Question about type cast in queue code |
| Date | Sun, 06 Dec 2015 12:28:50 -0800 |
| Organization | None to speak of |
| Lines | 32 |
| Message-ID | <lnd1ujpbi5.fsf@kst-u.example.com> (permalink) |
| References | <b3348687-a459-4ebc-89fe-5ff59f4bd55b@googlegroups.com> <n1ggg3$ag8$1@dont-email.me> <8c81e1b0-cd60-44a9-8d48-21b266a97ce9@googlegroups.com> <n1h3lu$6t1$1@dont-email.me> <MPG.30a71fd29d392c1b84@news.eternal-september.org> <d3c86bhci7p71v54e9ujpnq7cvt9f2k81g@4ax.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Injection-Info | mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="23714"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18tiFVdHnFFF0uRx1DPRcyu" |
| User-Agent | Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
| Cancel-Lock | sha1:Eeaf2Qi7HB9tgQBsavZLjQ3rz8U= sha1:ROuDRTtvzsLtX7p/ntWGCRI0W1k= |
| Xref | csiph.com comp.lang.c:77996 |
Show key headers only | View raw
David Thompson <dave.thompson2@verizon.net> writes:
> On Fri, 6 Nov 2015 20:37:10 -0800, Philip Lantz <prl@canterey.us>
> wrote:
[...]
>> struct Queue_Elem;
>>
>> int main()
>> {
>> Queue_Elem *elem = 0;
>> void *myQ = 0;
>>
>> elem != (Queue_Elem *)myQ;
>>
>> return 0;
>> }
>>
> As long as we're nitpicking, in C you need something like
>
> typedef struct new_tag_name Queue_Elem;
> /* new_tag_name MAY be Queue_Elem but need not */
No, you don't *need* a typedef. You can just refer to the type by
its original name, which happens to be `struct Queue_Elem`. Using a
typedef to give it a new name `Queue_Elem` is entirely optional.
> In C++ a tag works almost like a typedef. Not C.
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Question about type cast in queue code fl <rxjwg98@gmail.com> - 2015-11-05 12:21 -0800
Re: Question about type cast in queue code Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-11-05 20:43 +0000
Re: Question about type cast in queue code James Kuyper <jameskuyper@verizon.net> - 2015-11-05 16:10 -0500
Re: Question about type cast in queue code fl <rxjwg98@gmail.com> - 2015-11-05 16:50 -0800
Re: Question about type cast in queue code James Kuyper <jameskuyper@verizon.net> - 2015-11-05 21:37 -0500
Re: Question about type cast in queue code Philip Lantz <prl@canterey.us> - 2015-11-06 20:37 -0800
Re: Question about type cast in queue code James Kuyper <jameskuyper@verizon.net> - 2015-11-07 00:20 -0500
Re: Question about type cast in queue code Philip Lantz <prl@canterey.us> - 2015-11-07 11:51 -0800
Re: Question about type cast in queue code James Kuyper <jameskuyper@verizon.net> - 2015-11-07 15:34 -0500
Re: Question about type cast in queue code Philip Lantz <prl@canterey.us> - 2015-11-07 13:42 -0800
Re: Question about type cast in queue code James Kuyper <jameskuyper@verizon.net> - 2015-11-07 16:53 -0500
Re: Question about type cast in queue code David Thompson <dave.thompson2@verizon.net> - 2015-12-06 07:56 -0500
Re: Question about type cast in queue code Keith Thompson <kst-u@mib.org> - 2015-12-06 12:28 -0800
Re: Question about type cast in queue code Philip Lantz <prl@canterey.us> - 2015-12-06 13:29 -0800
Re: Question about type cast in queue code James Kuyper <jameskuyper@verizon.net> - 2015-12-06 18:18 -0500
Re: Question about type cast in queue code supercat@casperkitty.com - 2015-12-06 15:31 -0800
csiph-web