From 5124178322338075962
X-Google-Thread: 7894ca11fe,191c67e7ffa6c8e7,start
X-Google-Attributes: gid7894ca11fe,public,usenet
X-Google-NewGroupId: yes
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news2.google.com!news2.google.com!news.glorb.com!news2.glorb.com!news.alt.net
From: Trigve Siver <trigves@yahoo.com>
Newsgroups: comp.std.c++
Subject: Re: reinterpret_cast<char *>(&some_int)
Date: Wed, 13 Oct 2010 11:52:27 CST
Organization: unknown
Lines: 46
Sender: std-c++-request@ruralroute.cs.rpi.edu
Approved: austern@google.com
Message-ID: <402768.38178.qm@web110410.mail.gq1.yahoo.com>
NNTP-Posting-Host: netlab.cs.rpi.edu
Content-Type: text/plain; charset=utf-8
To: (Usenet)
Return-Path: <cppmods@assassin.cs.rpi.edu>
X-Hash: SCt|118745335635dafbf704497c7087f53f0f9bd92c|399459334153dc477ce38273af05e388
X-Countries: United States
X-SMTP-From: accepted <cppmods@assassin.cs.rpi.edu> assassin.cs.rpi.edu [128.113.126.17] (assassin.cs.rpi.edu) {United States}
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=cs.rpi.edu; h=date
	:to:sender:message-id:from:subject:content-type; s=default; i=
	128.113.126.17@cs.rpi.edu; t=1286988746; x=1287593546; l=1416;
	 bh=eih4/DEP8z0zZMHF1/c53HjVEfs=; b=mMz/cIfCYK5RksfBNjNF3pyYJtVK
	I7dUb4sqiUpe5xlIZzT4deGBSgxq6WNMFBefwD7WKl21DpyLhTgkEK1mNAHSpzCZ
	lawE2+7yDBZGNaL2jTFZdzXIXL5IWBjV6PT/rVwd9JGSgMTY8A9MUC4wxsZhS5SP
	4LKZqpq8C1kwEQA=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=cs.rpi.edu; h=date:to:sender
	:message-id:from:subject:content-type; q=dns; s=default; b=CNv5j
	R6T10r9YhPwGXP2OyHA5EhbN00oVGL3de+Mc9UrzlFwUJvs/AQ4eIN86cTqSY9Dj
	Ug6PdX/ebzJZUaOwplBRMnvq8axwbB2cnzcnWfRFKfTT8GoJxSOTfLAOU8aDkO/a
	xz6yn54VQdKfCEf+7vD6W2xEG+uyB6gHKLEwzg=
X-Spam-Report: Spam Report from cliffclavin.cs.rpi.edu (SA:3.2.5):
	-1.8 ALL_TRUSTED            Passed through trusted hosts only via SMTP
	3.4 HEADER_SPAM            Bulk email fingerprint (header-based) found
	2.3 FORGED_YAHOO_RCVD      'From' yahoo.com does not match 'Received' headers
	-0.9 BAYES_00               BODY: Bayesian spam probability is 0 to 1% [score: 0.0000]
	0.2 SARE_HEAD_HDR_APPROV   Message headers used which identify spam
X-Spam-Info: 3.2, local;
	ALL_TRUSTED,BAYES_00,FORGED_YAHOO_RCVD,HEADER_SPAM,
	SARE_HEAD_HDR_APPROV
X-Spam-Scanned-By: cliffclavin.cs.rpi.edu using SpamAssassin 3.2.5
X-Virus-Scanned-By: cliffclavin.cs.rpi.edu
X-Original-Date: Tue, 12 Oct 2010 00:35:44 -0700 (PDT)
X-Submission-Address: std-c++@netlab.cs.rpi.edu<std-c%2B%2B@netlab.cs.rpi.e=
	du>
X-Scanned-By: MIMEDefang 2.67 on 128.113.126.25
Xref: g2news2.google.com comp.std.c++:3045

 On 12. Okt, 02:06 h., James Kanze <james.ka...@gmail.com>  wrote:
>
> It is and it isn't.  About all you can say is that you're  more
> or less guaranted to pass the address of the int into
>  input.read.  Since this function expects the address of a char
> buffer,  and will write it as such, just about anything can
> happen after  that.

Is there ANY portable way to read binary data of PODs from file?  Only
method I
can think of is using "char *" buffer and  then "std::memcpy()" to target o=
f
POD
type (3.9/2).

> > And what  about reinterpret_cast<char *>(&some_pod)?
>
> The  same.

Then what is 5.2.10/7("...When a prvalue v of type =93pointer to T1=94  is
converted
to the type =93pointer to cv T2=94, the result is  static_cast<cv
T2*>(static_cast<cv void*>(v)) if both T1 and T2  are standard-layout types
(3.9) and the alignment requirements of T2 are no  stricter than those of
T1....") good for? Could someone give some practical  example where the
sentence
above could be applied and give some defined behaviour but without the
sentence
above it wouldn't, please?

Thank  you

Trigve





--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use
mailto:std-c++@netlab.cs.rpi.edu<std-c%2B%2B@netlab.cs.rpi.edu>
]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]



