Groups | Search | Server Info | Login | Register


Groups > comp.lang.c.moderated > #460

Re: Casting the first member of a struct (and back)

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c.moderated
Subject Re: Casting the first member of a struct (and back)
Date 2013-09-02 04:07 -0500
Organization None to speak of
Message-ID <clcm-20130902-0001@plethora.net> (permalink)
References <clcm-20130807-0001@plethora.net> <clcm-20130807-0002@plethora.net>

Show all headers | View raw


Francis Glassborow <francis.glassborow@btinternet.com> writes:
[...]
> You are confusing 'legal' with 'will work as expected'. The 
> implementation takes the programmer's word that a cast is valid. That is 
> the nature of casts in C. They are effectively an unchecked way of 
> changing the type of an area of memory.

Well, pointer casts are.  Numeric casts just convert a value of one type
to another in a (usually) well-defined way.

-- 
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"
-- 
comp.lang.c.moderated - moderation address: clcm@plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line.  Sorry.

Back to comp.lang.c.moderated | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Casting the first member of a struct (and back) stephan beal <sgbeal@googlemail.com> - 2013-08-07 01:06 -0500
  Re: Casting the first member of a struct (and back) Francis Glassborow <francis.glassborow@btinternet.com> - 2013-08-07 13:51 -0500
    Re: Casting the first member of a struct (and back) Keith Thompson <kst-u@mib.org> - 2013-09-02 04:07 -0500
  Re: Casting the first member of a struct (and back) James Kuyper <jameskuyper@verizon.net> - 2013-08-07 13:51 -0500
  Re: Casting the first member of a struct (and back) Jasen Betts <jasen@xnet.co.nz> - 2013-08-07 13:51 -0500

csiph-web