🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #80

Re: Scalars and Structs

#80
From: Daniel Edelson
Date: Mon, 03 Aug 1992 07:54
20 lines
1132 bytes
In article <1992Jul30.205601.13276@pasteur.Berkeley.EDU>, johnm@cory.Berkeley.EDU (John D. Mitchell) writes:
|> ANSI X3.159-1989:
|> 	Section 3.3.4 Cast Operators:
|> 		Constraints:
|> 			"Unless the type name specifies void type, the type
|> 			name shall specify qualified or unqualified scalar
|> 			type and the operand shall have scalar type."
|> 
|> Am I correct in taking this to mean that there is no way to cast a
|> structure of known size to a scalar that just so happens to have the same
|> size (or vice versa)?

There's always:

	struct S s;
	int i;

	i = *(int*)&s;

daniel.edelson@inria.fr
Technical Details
Message-ID: <4036@seti.UUCP>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!corton!seti!goudurix.inria.fr!edelson
References: <1992Jul30.205601.13276@pasteur.Berkeley.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!corton!seti!goudurix.inria.fr!edelson
From: edelson@goudurix.inria.fr (Daniel Edelson)
Newsgroups: comp.std.c
Subject: Re: Scalars and Structs
Keywords: casts
Message-ID: <4036@seti.UUCP>
Date: 3 Aug 92 07:54:28 GMT
References: <1992Jul30.205601.13276@pasteur.Berkeley.EDU>
Sender: news@seti.UUCP
Reply-To: Daniel R. Edelson <edelson@sor.inria.fr>
Organization: INRIA -- Institut National de Recherche en Informatique et Automatique -- Rocquencourt, France
Lines: 20