Return-Path: Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: (qmail 76955 invoked from network); 11 Apr 2008 01:21:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Apr 2008 01:21:20 -0000 Received: (qmail 23335 invoked by uid 500); 11 Apr 2008 01:21:17 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 23322 invoked by uid 500); 11 Apr 2008 01:21:17 -0000 Mailing-List: contact dev-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list dev@stdcxx.apache.org Received: (qmail 23307 invoked by uid 99); 11 Apr 2008 01:21:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Apr 2008 18:21:17 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of msebor@gmail.com designates 209.85.200.172 as permitted sender) Received: from [209.85.200.172] (HELO wf-out-1314.google.com) (209.85.200.172) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Apr 2008 01:20:34 +0000 Received: by wf-out-1314.google.com with SMTP id 27so264851wfd.2 for ; Thu, 10 Apr 2008 18:20:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:organization:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; bh=ipTdK7qmP29fqj1sB/brsvdvKmTFz3tt88bHS82+jbE=; b=NwtIrP670neHdBgKw3cPE2GuCHKNKugJSAjZ6PTWFmLJ3DRQ1QpKG6NiOqGimcJgXV0/t1e1DMh6kKgm9xw8SDkudQs0ZH/Hs2jjLghzF5hdoyvAEeNSzOLtkChs10Rw+e8G7zTiwDJHa4JmJIvhtJaXsqgg0XgUAmpqh+Vg1TY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:organization:user-agent:mime-version:to:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=ShBUW+WfKHt+9gSzozv+ULQ842ognHwAGyeJxSQ6WFzLvIdXxNXlHXdYGARVONhTkhAZAnDrff2jqp/znCgpk8uiat18ijgqu/k1gG0jL04doiJZpz53OfloCvcHgCvsOEx/icenFMywk3ZGfwRgZ28gcUyebxrUOQOO/6Gzkho= Received: by 10.142.47.6 with SMTP id u6mr639080wfu.267.1207876847097; Thu, 10 Apr 2008 18:20:47 -0700 (PDT) Received: from localhost.localdomain ( [71.229.200.170]) by mx.google.com with ESMTPS id 24sm4148488wfc.18.2008.04.10.18.20.45 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 10 Apr 2008 18:20:46 -0700 (PDT) Message-ID: <47FEBCEC.20609@roguewave.com> Date: Thu, 10 Apr 2008 19:20:44 -0600 From: Martin Sebor Organization: Rogue Wave Software, Inc. User-Agent: Thunderbird 2.0.0.12 (X11/20080226) MIME-Version: 1.0 To: dev@stdcxx.apache.org Subject: Re: Null src pointer in memcpy? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: Martin Sebor X-Virus-Checked: Checked by ClamAV on apache.org Eric Lemings wrote: > > Is it safe to pass a null pointer as the 2nd argument to memcpy()? Or > undefined? Assuming the third argument is 0. Strictly speaking I believe it's undefined because memcpy(s1, s2, n) is specified to "copy n bytes from the object pointed to by s2 into the object pointed to by s1" and a null pointer doesn't point to an object. An object is defined as "a region of storage in the execution environment, the contents of which can represent values." AFAIK, most implementations allow null pointers for no-op calls to memcpy() but gcc issues a warning when it detects at compile time that a null pointer is passed as the first or second argument to memcpy(). Martin