Topic: Pointer arithmatic on void pointers


Author: jgottman6@gmail.com
Date: Wed, 9 Jul 2014 19:21:21 -0700 (PDT)
Raw View
------=_Part_38_32235180.1404958881856
Content-Type: text/plain; charset=UTF-8

Often, when I am working with raw memory, I need to write some bytes to a
void * buffer then determine where the write ended so I can write some more
bytes.  I find it very annoying that I can't do simple pointer arithmetic
on void *'s.  Instead I have to write code like

void *buffer;
// write to buffer
buffer = static_cast<char *>(buffer) + 42;

What would be the harm of defining pointer arithmetic on void pointers?
Adding or subtracting a size_t to a void * would be equivalent to static
casting to char *, adding the number, and casting back to void. Similarly,
we could define the difference of two void pointers by casting each to char
* and subtracting those.

Joe Gottman

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_38_32235180.1404958881856
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Often, when I am working with raw memory, I need to write =
some bytes to a void * buffer then determine where the write ended so I can=
 write some more bytes.&nbsp; I find it very annoying that I can't do simpl=
e pointer arithmetic on void *'s.&nbsp; Instead I have to write code like<b=
r><br><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 2=
50); border-color: rgb(187, 187, 187); border-style: solid; border-width: 1=
px; word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subpr=
ettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">void</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">*</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">buffer</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #800;" c=
lass=3D"styled-by-prettify">// write to buffer</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"><br>buffer </span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">static_cast</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">char</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">*&gt;(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">b=
uffer</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">+</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #0=
66;" class=3D"styled-by-prettify">42</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br></span></div></code></div><br>What would be the harm o=
f defining pointer arithmetic on void pointers?&nbsp; Adding or subtracting=
 a size_t to a void * would be equivalent to static casting to char *, addi=
ng the number, and casting back to void. Similarly, we could define the dif=
ference of two void pointers by casting each to char * and subtracting thos=
e.<br><br>Joe Gottman<br></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_38_32235180.1404958881856--

.


Author: David Krauss <potswa@gmail.com>
Date: Thu, 10 Jul 2014 10:30:49 +0800
Raw View
--Apple-Mail=_208C7E01-84CD-4C4B-A398-6DB64ABA7925
Content-Type: text/plain; charset=ISO-8859-1


On 2014-07-10, at 10:21 AM, jgottman6@gmail.com wrote:

> Often, when I am working with raw memory, I need to write some bytes to a void * buffer then determine where the write ended so I can write some more bytes.

Are you writing voids? No, you're writing bytes, a.k.a. chars. reinterpret_cast< char * > is the right tool for the job here, give or take an unsigned.

> I find it very annoying that I can't do simple pointer arithmetic on void *'s.  Instead I have to write code like
>
> void *buffer;
> // write to buffer
> buffer = static_cast<char *>(buffer) + 42;
>
> What would be the harm of defining pointer arithmetic on void pointers?

It would be nonsense. void* and char* are different types for a good reason. If you don't like void*, then never use it! reinterpret_cast< char * > encapsulates the cast through void*.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--Apple-Mail=_208C7E01-84CD-4C4B-A398-6DB64ABA7925
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 2014&=
ndash;07&ndash;10, at 10:21 AM, <a href=3D"mailto:jgottman6@gmail.com">jgot=
tman6@gmail.com</a> wrote:</div><br class=3D"Apple-interchange-newline"><bl=
ockquote type=3D"cite"><div dir=3D"ltr">Often, when I am working with raw m=
emory, I need to write some bytes to a void * buffer then determine where t=
he write ended so I can write some more bytes.&nbsp; </div></blockquote><di=
v><br></div><div>Are you writing <font face=3D"Courier">void</font>s? No, y=
ou&rsquo;re writing bytes, a.k.a. <font face=3D"Courier">char</font>s. <fon=
t face=3D"Courier">reinterpret_cast&lt; char * &gt;</font> is the right too=
l for the job here, give or take an <font face=3D"Courier">unsigned</font>.=
</div><br><blockquote type=3D"cite"><div dir=3D"ltr">I find it very annoyin=
g that I can't do simple pointer arithmetic on void *'s.&nbsp; Instead I ha=
ve to write code like<br><br><div class=3D"prettyprint" style=3D"background=
-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style:=
 solid; border-width: 1px; word-wrap: break-word;"><code class=3D"prettypri=
nt"><span style=3D"color: #008;" class=3D"styled-by-prettify">void</span> <=
span style=3D"color: #660;" class=3D"styled-by-prettify">*</span>buffer<spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">;</span><br><span sty=
le=3D"color: #800;" class=3D"styled-by-prettify">// write to buffer</span><=
br>buffer <span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</sp=
an> <span style=3D"color: #008;" class=3D"styled-by-prettify">static_cast</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">char</span> <span =
style=3D"color: #660;" class=3D"styled-by-prettify">*&gt;(</span>buffer<spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">)</span> <span style=
=3D"color: #660;" class=3D"styled-by-prettify">+</span> <span style=3D"colo=
r: #066;" class=3D"styled-by-prettify">42</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">;</span><br></code></div><br>What would be t=
he harm of defining pointer arithmetic on void pointers?&nbsp; </div></bloc=
kquote><div><br></div><div>It would be nonsense. <font face=3D"Courier">voi=
d*</font> and <font face=3D"Courier">char*</font> are different types for a=
 good reason. If you don&rsquo;t like <font face=3D"Courier">void*</font>, =
then never use it! <font face=3D"Courier">reinterpret_cast&lt; char * &gt;<=
/font>&nbsp;encapsulates the cast through <font face=3D"Courier">void*</fon=
t>.</div></div><br></body></html>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--Apple-Mail=_208C7E01-84CD-4C4B-A398-6DB64ABA7925--

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Wed, 09 Jul 2014 20:04 -0700
Raw View
On Thursday 10 July 2014 10:30:49 David Krauss wrote:
> > Often, when I am working with raw memory, I need to write some bytes to a
> > void * buffer then determine where the write ended so I can write some
> > more bytes.
> Are you writing voids? No, you're writing bytes, a.k.a. chars.
> reinterpret_cast< char * > is the right tool for the job here, give or take
> an unsigned.

He's probably writing using memcpy, which takes void pointers. That means the
reinterpret_cast back to char is hidden inside the source code of memcpy.

However, that's exactly what's happening: the operations are actually on
char*.

Not to mention that both the C and C++ standards treat bytes and char as being
synonymous. CHAR_BIT is "number of bits for the smallest object that is not a
bitfield (byte)".

Yes, there can be machines that can address entities of size smaller than 1
char, but for our purposes in the standard, we can ignore them.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

.


Author: David Krauss <potswa@gmail.com>
Date: Thu, 10 Jul 2014 11:08:18 +0800
Raw View
--Apple-Mail=_29B0D0DA-1328-4EDA-9297-01F42A0E1FB5
Content-Type: text/plain; charset=ISO-8859-1


On 2014-07-10, at 11:04 AM, Thiago Macieira <thiago@macieira.org> wrote:

> On Thursday 10 July 2014 10:30:49 David Krauss wrote:
>>> Often, when I am working with raw memory, I need to write some bytes to a
>>> void * buffer then determine where the write ended so I can write some
>>> more bytes.
>> Are you writing voids? No, you're writing bytes, a.k.a. chars.
>> reinterpret_cast< char * > is the right tool for the job here, give or take
>> an unsigned.
>
> He's probably writing using memcpy, which takes void pointers. That means the
> reinterpret_cast back to char is hidden inside the source code of memcpy.

Well, std::copy< char const *, char * > is quite likely to delegate to memcpy, and even if it doesn't, std::char_traits< char >::copy almost certainly will. These are more C++-like.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--Apple-Mail=_29B0D0DA-1328-4EDA-9297-01F42A0E1FB5
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 2014&=
ndash;07&ndash;10, at 11:04 AM, Thiago Macieira &lt;<a href=3D"mailto:thiag=
o@macieira.org">thiago@macieira.org</a>&gt; wrote:</div><br class=3D"Apple-=
interchange-newline"><blockquote type=3D"cite">On Thursday 10 July 2014 10:=
30:49 David Krauss wrote:<br><blockquote type=3D"cite"><blockquote type=3D"=
cite">Often, when I am working with raw memory, I need to write some bytes =
to a<br>void * buffer then determine where the write ended so I can write s=
ome<br>more bytes. <br></blockquote>Are you writing voids? No, you're writi=
ng bytes, a.k.a. chars.<br>reinterpret_cast&lt; char * &gt; is the right to=
ol for the job here, give or take<br>an unsigned.<br></blockquote><br>He's =
probably writing using memcpy, which takes void pointers. That means the <b=
r>reinterpret_cast back to char is hidden inside the source code of memcpy.=
<br></blockquote><div><br></div><div>Well, <font face=3D"Courier">std::copy=
&lt; char const *, char * &gt;</font> is quite likely to delegate to <font =
face=3D"Courier">memcpy</font>, and even if it doesn&rsquo;t, <font face=3D=
"Courier">std::char_traits&lt; char &gt;::copy</font> almost certainly will=
.. These are more C++-like.</div></div><br></body></html>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--Apple-Mail=_29B0D0DA-1328-4EDA-9297-01F42A0E1FB5--

.


Author: David Krauss <potswa@gmail.com>
Date: Thu, 10 Jul 2014 11:10:55 +0800
Raw View
--Apple-Mail=_342177E4-C58D-4AB3-B161-9E1C89FC2331
Content-Type: text/plain; charset=ISO-8859-1


On 2014-07-10, at 11:08 AM, David Krauss <potswa@gmail.com> wrote:

> Well, std::copy< char const *, char * > is quite likely to delegate to memcpy, and even if it doesn't, std::char_traits< char >::copy almost certainly will. These are more C++-like.

.... and, they both perform the addition which is troubling Joe in the first place, returning the next byte to be written.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--Apple-Mail=_342177E4-C58D-4AB3-B161-9E1C89FC2331
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 2014&=
ndash;07&ndash;10, at 11:08 AM, David Krauss &lt;<a href=3D"mailto:potswa@g=
mail.com">potswa@gmail.com</a>&gt; wrote:</div><br class=3D"Apple-interchan=
ge-newline"><blockquote type=3D"cite"><meta http-equiv=3D"Content-Type" con=
tent=3D"text/html charset=3Dwindows-1252"><div style=3D"word-wrap: break-wo=
rd; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Well,=
 <font face=3D"Courier">std::copy&lt; char const *, char * &gt;</font> is q=
uite likely to delegate to <font face=3D"Courier">memcpy</font>, and even i=
f it doesn&rsquo;t, <font face=3D"Courier">std::char_traits&lt; char &gt;::=
copy</font> almost certainly will. These are more C++-like.<br></div></bloc=
kquote></div><br><div>&hellip; and, they both perform the addition which is=
 troubling Joe in the first place, returning the next byte to be written.</=
div><div><br></div></body></html>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--Apple-Mail=_342177E4-C58D-4AB3-B161-9E1C89FC2331--

.


Author: David Krauss <potswa@gmail.com>
Date: Thu, 10 Jul 2014 11:13:23 +0800
Raw View
--Apple-Mail=_A1424295-9652-4FE3-9E95-111D60B15A3D
Content-Type: text/plain; charset=ISO-8859-1


On 2014-07-10, at 11:10 AM, David Krauss <potswa@gmail.com> wrote:

>
> On 2014-07-10, at 11:08 AM, David Krauss <potswa@gmail.com> wrote:
>
>> Well, std::copy< char const *, char * > is quite likely to delegate to memcpy, and even if it doesn't, std::char_traits< char >::copy almost certainly will. These are more C++-like.
>
> ... and, they both perform the addition which is troubling Joe in the first place, returning the next byte to be written.

My bad, std::char_traits< char >::copy is only a wrapper for memcpy. It does not return an updated pointer. Sorry for the noise.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--Apple-Mail=_A1424295-9652-4FE3-9E95-111D60B15A3D
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=ISO-8859-1

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dwindows-1252"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-=
mode: space; -webkit-line-break: after-white-space;"><br><div><div>On 2014&=
ndash;07&ndash;10, at 11:10 AM, David Krauss &lt;<a href=3D"mailto:potswa@g=
mail.com">potswa@gmail.com</a>&gt; wrote:</div><br class=3D"Apple-interchan=
ge-newline"><blockquote type=3D"cite"><meta http-equiv=3D"Content-Type" con=
tent=3D"text/html charset=3Dwindows-1252"><div style=3D"word-wrap: break-wo=
rd; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><=
div><div>On 2014&ndash;07&ndash;10, at 11:08 AM, David Krauss &lt;<a href=
=3D"mailto:potswa@gmail.com">potswa@gmail.com</a>&gt; wrote:</div><br class=
=3D"Apple-interchange-newline"><blockquote type=3D"cite"><meta http-equiv=
=3D"Content-Type" content=3D"text/html charset=3Dwindows-1252"><div style=
=3D"word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: af=
ter-white-space;">Well, <font face=3D"Courier">std::copy&lt; char const *, =
char * &gt;</font> is quite likely to delegate to <font face=3D"Courier">me=
mcpy</font>, and even if it doesn&rsquo;t, <font face=3D"Courier">std::char=
_traits&lt; char &gt;::copy</font> almost certainly will. These are more C+=
+-like.<br></div></blockquote></div><br><div>&hellip; and, they both perfor=
m the addition which is troubling Joe in the first place, returning the nex=
t byte to be written.</div></div></blockquote><br></div><div>My bad,&nbsp;<=
span style=3D"font-family: Courier;">std::char_traits&lt; char &gt;::copy</=
span>&nbsp;is only a wrapper for memcpy. It does not return an updated poin=
ter. Sorry for the noise.</div><br></body></html>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--Apple-Mail=_A1424295-9652-4FE3-9E95-111D60B15A3D--

.


Author: walter1234 <walter2bz@gmail.com>
Date: Mon, 21 Jul 2014 15:42:57 -0700 (PDT)
Raw View
------=_Part_331_279532281.1405982577578
Content-Type: text/plain; charset=UTF-8

Having void* for representing raw memory (and being able to do pointer
arithmetic) - the fact it *isn't* typed as some actual type. allocate some
big void* buffer into which you are going to poke some specific types.

its also a shame C++ makes itself incompatible with plain C on the way
void* doesn't auto-coerce to other types. its there for raw bytes only.

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

------=_Part_331_279532281.1405982577578
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Having void* for representing raw memory (and being able t=
o do pointer arithmetic) - the fact it *isn't* typed as some actual type. a=
llocate some big void* buffer into which you are going to poke some specifi=
c types.<div><br></div><div>its also a shame C++ makes itself incompatible =
with plain C on the way void* doesn't auto-coerce to other types. its there=
 for raw bytes only.</div></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

------=_Part_331_279532281.1405982577578--

.


Author: "'Geoffrey Romer' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Mon, 21 Jul 2014 19:00:35 -0700
Raw View
--089e013cb9aee75c3704febe96d8
Content-Type: text/plain; charset=UTF-8

The C++ standard is quite clear and consistent about the fact that the type
of raw bytes is [unsigned] char, not void. void* does not mean "pointer to
raw bytes", it means "pointer to unknown type". The fact that you have to
explicitly reinterpret_cast of you want to access the raw bytes is a
feature, not a bug- that's basically what reinterpret_cast is there for.
On Jul 21, 2014 3:42 PM, "walter1234" <walter2bz@gmail.com> wrote:

> Having void* for representing raw memory (and being able to do pointer
> arithmetic) - the fact it *isn't* typed as some actual type. allocate some
> big void* buffer into which you are going to poke some specific types.
>
> its also a shame C++ makes itself incompatible with plain C on the way
> void* doesn't auto-coerce to other types. its there for raw bytes only.
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--089e013cb9aee75c3704febe96d8
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<p dir=3D"ltr">The C++ standard is quite clear and consistent about the fac=
t that the type of raw bytes is [unsigned] char, not void. void* does not m=
ean &quot;pointer to raw bytes&quot;, it means &quot;pointer to unknown typ=
e&quot;. The fact that you have to explicitly reinterpret_cast of you want =
to access the raw bytes is a feature, not a bug- that&#39;s basically what =
reinterpret_cast is there for.</p>

<div class=3D"gmail_quote">On Jul 21, 2014 3:42 PM, &quot;walter1234&quot; =
&lt;<a href=3D"mailto:walter2bz@gmail.com">walter2bz@gmail.com</a>&gt; wrot=
e:<br type=3D"attribution"><blockquote class=3D"gmail_quote" style=3D"margi=
n:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir=3D"ltr">Having void* for representing raw memory (and being able t=
o do pointer arithmetic) - the fact it *isn&#39;t* typed as some actual typ=
e. allocate some big void* buffer into which you are going to poke some spe=
cific types.<div>
<br></div><div>its also a shame C++ makes itself incompatible with plain C =
on the way void* doesn&#39;t auto-coerce to other types. its there for raw =
bytes only.</div></div>

<p></p>

-- <br>
<br>
--- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</blockquote></div>

<p></p>

-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--089e013cb9aee75c3704febe96d8--

.