From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8941 invoked by alias); 16 Aug 2008 11:43:00 -0000 Received: (qmail 8933 invoked by uid 22791); 16 Aug 2008 11:42:59 -0000 X-Spam-Check-By: sourceware.org Received: from qb-out-1314.google.com (HELO qb-out-1314.google.com) (72.14.204.175) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 16 Aug 2008 11:42:02 +0000 Received: by qb-out-1314.google.com with SMTP id q18so1569809qbq.28 for ; Sat, 16 Aug 2008 04:42:00 -0700 (PDT) Received: by 10.115.111.1 with SMTP id o1mr3608966wam.100.1218886920423; Sat, 16 Aug 2008 04:42:00 -0700 (PDT) Received: by 10.114.202.20 with HTTP; Sat, 16 Aug 2008 04:42:00 -0700 (PDT) Message-ID: <25c035550808160442n695bb421m79e58ede2d203e0@mail.gmail.com> Date: Sat, 16 Aug 2008 12:31:00 -0000 From: Philip To: gcc-help@gcc.gnu.org Subject: reinterpret_casting a non-POD MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2008-08/txt/msg00155.txt.bz2 Given a simple but currently non-POD class such as: struct Point { float x, y, z; Point () {} Point (float x_, float y_, float z_): x (x_), y (y_), z (z_) {} }; Is there any risk involved in the following operations?: Point p; float* pp = reinterpret_cast (&p); void* buffer = // acquire memory Point* points = reinterpret_cast (buffer); // do stuff that treats buffer as array of Points float* floats = reinterpret_cast (points); Thanks.