Topic: A small proposal to warnings on manipulation with
Author: =?UTF-8?Q?Peter_Bo=C4=8Dan?= <peppy.bocan@gmail.com>
Date: Tue, 4 Mar 2014 14:47:56 -0800 (PST)
Raw View
------=_Part_3307_4063204.1393973276925
Content-Type: text/plain; charset=UTF-8
Hello guys, we have found that this code:
int main()
{
int *a = new int(64); // single dynamic variable
for (int i= 0; i < 10000; i++)
a[i] = 10; // I am out of space allocated for "a".
delete a;
return 0;
}
build as: g++ -Wall -pedantic -Werror main.cpp has no syntactical issues
and compiler does not warn treating a dynamic (POD !) variable as an
array... this "feature" will take down a program. Would it be possible to
have a warning/error statement, that this is not possible?
Thanks folks, Peter Bocan.
--
---
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_3307_4063204.1393973276925
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Hello guys, we have found that this code:<div><br><div><di=
v class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); bord=
er: 1px solid rgb(187, 187, 187); word-wrap: break-word;"><code class=3D"pr=
ettyprint"><div class=3D"subprettyprint"><div class=3D"subprettyprint"><fon=
t face=3D"courier new, monospace">int main()<br>{</font></div><div class=3D=
"subprettyprint"><font face=3D"courier new, monospace"> int *a =
=3D new int(64); // single dynamic variable<br></font></div><div class=3D"s=
ubprettyprint"><font face=3D"courier new, monospace"><br></font></div><div =
class=3D"subprettyprint"><font face=3D"courier new, monospace">  =
;for (int i=3D 0; i < 10000; i++)</font></div><div class=3D"subprettypri=
nt"><font face=3D"courier new, monospace"> <span class=3D"Apple=
-tab-span" style=3D"white-space:pre"> </span>a[i] =3D 10; // I am out of sp=
ace allocated for "a".</font></div><div class=3D"subprettyprint"><font face=
=3D"courier new, monospace"> </font></div><div class=3D"subpret=
typrint"><font face=3D"courier new, monospace"> delete a;</font=
></div><div class=3D"subprettyprint"><font face=3D"courier new, monospace">=
<br></font></div><div class=3D"subprettyprint"><font face=3D"courier new, m=
onospace"> return 0;</font></div><div class=3D"subprettyprint">=
<font face=3D"courier new, monospace">}</font></div><div><br></div></div></=
code></div><div><br></div>build as: <font face=3D"courier new, monospace">g=
++ -Wall -pedantic -Werror main.cpp</font> has no syntactical issues =
and compiler does not warn treating a dynamic (POD !) variable as an array.=
... this "feature" will take down a program. Would it be possible to have a =
warning/error statement, that this is not possible? </div></div><div><=
br></div><div>Thanks folks, Peter Bocan.</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" 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_3307_4063204.1393973276925--
.
Author: Matthew Woehlke <mw_triad@users.sourceforge.net>
Date: Tue, 04 Mar 2014 18:15:21 -0500
Raw View
On 2014-03-04 17:47, Peter Bo=C4=8Dan wrote:
> Hello guys, we have found that this code:
>
> int main()
> {
> int *a =3D new int(64); // single dynamic variable
>
> for (int i=3D 0; i < 10000; i++)
> a[i] =3D 10; // I am out of space allocated for "a".
>
> delete a;
>
> return 0;
> }
>
>
> build as: g++ -Wall -pedantic -Werror main.cpp has no syntactical issues
> and compiler does not warn treating a dynamic (POD !) variable as an
> array... this "feature" will take down a program. Would it be possible to
> have a warning/error statement, that this is not possible?
How would the compiler warn? The return type of operator new[] is not=20
[guaranteed to be] a fixed-size array. What if your code instead looked=20
like:
extern int arr_size;
int* foo() { return new int(arr_size); }
int main()
{
int *a =3D foo();
/* same code accessing 'a' */
}
....?
The size of 'a' may not be known at compile time at all.
I'm not sure of the value of forcing an array return type (never mind=20
that arrays still decay to pointers) for operator new when the compiler=20
is able to statically determine the size. That's normally the domain of=20
static analysis tools.
--=20
Matthew
--=20
---=20
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 e=
mail 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-proposa=
ls/.
.
Author: Richard Smith <richard@metafoo.co.uk>
Date: Tue, 4 Mar 2014 15:43:15 -0800
Raw View
--001a11c14836cff08904f3d0778a
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Tue, Mar 4, 2014 at 2:47 PM, Peter Bo=C4=8Dan <peppy.bocan@gmail.com> wr=
ote:
> Hello guys, we have found that this code:
>
> int main()
> {
> int *a =3D new int(64); // single dynamic variable
>
> for (int i=3D 0; i < 10000; i++)
> a[i] =3D 10; // I am out of space allocated for "a".
>
> delete a;
>
> return 0;
> }
>
>
> build as: g++ -Wall -pedantic -Werror main.cpp has no syntactical issues
> and compiler does not warn treating a dynamic (POD !) variable as an
> array... this "feature" will take down a program. Would it be possible to
> have a warning/error statement, that this is not possible?
>
GCC feature requests are off-topic for this list. Try
http://gcc.gnu.org/bugzilla
--=20
---=20
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 e=
mail 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-proposa=
ls/.
--001a11c14836cff08904f3d0778a
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On T=
ue, Mar 4, 2014 at 2:47 PM, Peter Bo=C4=8Dan <span dir=3D"ltr"><<a href=
=3D"mailto:peppy.bocan@gmail.com" target=3D"_blank">peppy.bocan@gmail.com</=
a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr">Hello guys, we have found t=
hat this code:<div><br><div><div style=3D"background-color:rgb(250,250,250)=
;border:1px solid rgb(187,187,187);word-wrap:break-word">
<code><div><div><font face=3D"courier new, monospace">int main()<br>{</font=
></div><div><font face=3D"courier new, monospace">=C2=A0 =C2=A0int *a =3D n=
ew int(64); // single dynamic variable<br></font></div><div><font face=3D"c=
ourier new, monospace"><br>
</font></div><div><font face=3D"courier new, monospace">=C2=A0 =C2=A0for (i=
nt i=3D 0; i < 10000; i++)</font></div><div><font face=3D"courier new, m=
onospace">=C2=A0 =C2=A0<span style=3D"white-space:pre-wrap"> </span>a[i] =
=3D 10; // I am out of space allocated for "a".</font></div>
<div><font face=3D"courier new, monospace">=C2=A0 =C2=A0</font></div><div><=
font face=3D"courier new, monospace">=C2=A0 =C2=A0delete a;</font></div><di=
v><font face=3D"courier new, monospace"><br></font></div><div><font face=3D=
"courier new, monospace">=C2=A0 =C2=A0return 0;</font></div>
<div><font face=3D"courier new, monospace">}</font></div><div><br></div></d=
iv></code></div><div><br></div>build as: <font face=3D"courier new, monospa=
ce">g++ -Wall -pedantic -Werror main.cpp</font>=C2=A0 has no syntactical is=
sues and compiler does not warn treating a dynamic (POD !) variable as an a=
rray... this "feature" will take down a program. Would it be poss=
ible to have a warning/error statement, that this is not possible?=C2=A0</d=
iv>
</div></div></blockquote><div><br></div><div>GCC feature requests are off-t=
opic for this list. Try <a href=3D"http://gcc.gnu.org/bugzilla">http://gcc.=
gnu.org/bugzilla</a></div></div></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" 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 />
--001a11c14836cff08904f3d0778a--
.
Author: Zhihao Yuan <zy@miator.net>
Date: Tue, 4 Mar 2014 18:48:48 -0500
Raw View
On Tue, Mar 4, 2014 at 5:47 PM, Peter Bo=C4=8Dan <peppy.bocan@gmail.com> wr=
ote:
> Hello guys, we have found that this code:
>
> int main()
> {
> int *a =3D new int(64); // single dynamic variable
>
> for (int i=3D 0; i < 10000; i++)
> a[i] =3D 10; // I am out of space allocated for "a".
>
> delete a;
>
> return 0;
> }
>
>
> build as: g++ -Wall -pedantic -Werror main.cpp has no syntactical issues
> and compiler does not warn treating a dynamic (POD !) variable as an
> array... this "feature" will take down a program. Would it be possible to
> have a warning/error statement, that this is not possible?
That's the exact reason we split observer_ptr into observer_ptr<T>
and observer_ptr<T[]> and only support pointer arithmetic in the
later one:
http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2014/n3840.pdf
This paper will be reviewed as a part of Library Fundamental TS v2
(I believe; I forgot the straw polls).
So you write
auto a =3D make_observer(new int(64));
// ...
a[i] =3D 10; // there you go, does not compile
To get a[i] work, you need
auto a =3D observer_ptr<int[]>(new int[10]);
Hmm, we should tune make_observer :)
--=20
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
___________________________________________________
4BSD -- http://4bsd.biz/
--=20
---=20
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 e=
mail 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-proposa=
ls/.
.
Author: =?UTF-8?Q?Peter_Bo=C4=8Dan?= <peppy.bocan@gmail.com>
Date: Tue, 4 Mar 2014 22:54:08 -0800 (PST)
Raw View
------=_Part_167_22558200.1394002448222
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
This problem is not gcc-only. Clang does it, as well.
D=C5=88a streda, 5. marca 2014 0:43:15 UTC+1 Richard Smith nap=C3=ADsal(-a)=
:
>
> On Tue, Mar 4, 2014 at 2:47 PM, Peter Bo=C4=8Dan <peppy...@gmail.com<java=
script:>
> > wrote:
>
>> Hello guys, we have found that this code:
>>
>> int main()
>> {
>> int *a =3D new int(64); // single dynamic variable
>>
>> for (int i=3D 0; i < 10000; i++)
>> a[i] =3D 10; // I am out of space allocated for "a".
>> =20
>> delete a;
>>
>> return 0;
>> }
>>
>>
>> build as: g++ -Wall -pedantic -Werror main.cpp has no syntactical=20
>> issues and compiler does not warn treating a dynamic (POD !) variable as=
an=20
>> array... this "feature" will take down a program. Would it be possible t=
o=20
>> have a warning/error statement, that this is not possible?=20
>>
>
> GCC feature requests are off-topic for this list. Try=20
> http://gcc.gnu.org/bugzilla
>
--=20
---=20
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 e=
mail 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-proposa=
ls/.
------=_Part_167_22558200.1394002448222
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">This problem is not gcc-only. Clang does it, as well.<br><=
br>D=C5=88a streda, 5. marca 2014 0:43:15 UTC+1 Richard Smith nap=C3=ADsal(=
-a):<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex=
;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><div=
class=3D"gmail_quote">On Tue, Mar 4, 2014 at 2:47 PM, Peter Bo=C4=8Dan <sp=
an dir=3D"ltr"><<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated=
-mailto=3D"CI7TWsFNYzMJ" onmousedown=3D"this.href=3D'javascript:';return tr=
ue;" onclick=3D"this.href=3D'javascript:';return true;">peppy...@gmail.com<=
/a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr">Hello guys, we have found t=
hat this code:<div><br><div><div style=3D"background-color:rgb(250,250,250)=
;border:1px solid rgb(187,187,187);word-wrap:break-word">
<code><div><div><font face=3D"courier new, monospace">int main()<br>{</font=
></div><div><font face=3D"courier new, monospace"> int *a =3D n=
ew int(64); // single dynamic variable<br></font></div><div><font face=3D"c=
ourier new, monospace"><br>
</font></div><div><font face=3D"courier new, monospace"> for (i=
nt i=3D 0; i < 10000; i++)</font></div><div><font face=3D"courier new, m=
onospace"> <span style=3D"white-space:pre-wrap"> </span>a[i] =
=3D 10; // I am out of space allocated for "a".</font></div>
<div><font face=3D"courier new, monospace"> </font></div><div><=
font face=3D"courier new, monospace"> delete a;</font></div><di=
v><font face=3D"courier new, monospace"><br></font></div><div><font face=3D=
"courier new, monospace"> return 0;</font></div>
<div><font face=3D"courier new, monospace">}</font></div><div><br></div></d=
iv></code></div><div><br></div>build as: <font face=3D"courier new, monospa=
ce">g++ -Wall -pedantic -Werror main.cpp</font> has no syntactical is=
sues and compiler does not warn treating a dynamic (POD !) variable as an a=
rray... this "feature" will take down a program. Would it be possible to ha=
ve a warning/error statement, that this is not possible? </div>
</div></div></blockquote><div><br></div><div>GCC feature requests are off-t=
opic for this list. Try <a href=3D"http://gcc.gnu.org/bugzilla" target=3D"_=
blank" onmousedown=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F=
%2Fgcc.gnu.org%2Fbugzilla\46sa\75D\46sntz\0751\46usg\75AFQjCNGfVCeQwDl_YsI4=
FcnOBcsf9e_cHg';return true;" onclick=3D"this.href=3D'http://www.google.com=
/url?q\75http%3A%2F%2Fgcc.gnu.org%2Fbugzilla\46sa\75D\46sntz\0751\46usg\75A=
FQjCNGfVCeQwDl_YsI4FcnOBcsf9e_cHg';return true;">http://gcc.gnu.org/bugzill=
a</a></div></div></div></div>
</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" 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_167_22558200.1394002448222--
.
Author: Thiago Macieira <thiago@macieira.org>
Date: Tue, 04 Mar 2014 23:30:20 -0800
Raw View
Em ter 04 mar 2014, =C3=A0s 14:47:56, Peter Bo=C4=8Dan escreveu:
> build as: g++ -Wall -pedantic -Werror main.cpp has no syntactical issues=
=20
> and compiler does not warn treating a dynamic (POD !) variable as an=20
> array... this "feature" will take down a program. Would it be possible to=
=20
> have a warning/error statement, that this is not possible?=20
>=20
> Thanks folks, Peter Bocan.
Yes, you can have it.
But this list is the wrong place to ask for diagnostics from your compiler.=
=20
You should go to http://gcc.gnu.org/bugzilla/ and http://llvm.org/bugs/ for=
=20
GCC and Clang, respectively.
Also note that your program becomes valid if I add this function to another=
=20
translation unit:
void *operator new(size_t size)
{
return malloc(std::min(size, size_t(40000)));
}
Since the standard does allow you to override the global operator new, it's=
=20
entirely possible possible for your program to be well-formed...
--=20
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
--=20
---=20
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 e=
mail 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-proposa=
ls/.
.
Author: =?UTF-8?Q?Peter_Bo=C4=8Dan?= <peppy.bocan@gmail.com>
Date: Tue, 4 Mar 2014 23:43:02 -0800 (PST)
Raw View
------=_Part_232_4229172.1394005382405
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Yes, I will push it to them. Thank you guys.
D=C5=88a streda, 5. marca 2014 8:30:20 UTC+1 Thiago Macieira nap=C3=ADsal(-=
a):
>
> Em ter 04 mar 2014, =C3=A0s 14:47:56, Peter Bo=C4=8Dan escreveu:=20
> > build as: g++ -Wall -pedantic -Werror main.cpp has no syntactical=20
> issues=20
> > and compiler does not warn treating a dynamic (POD !) variable as an=20
> > array... this "feature" will take down a program. Would it be possible=
=20
> to=20
> > have a warning/error statement, that this is not possible?=20
> >=20
> > Thanks folks, Peter Bocan.=20
>
> Yes, you can have it.=20
>
> But this list is the wrong place to ask for diagnostics from your=20
> compiler.=20
> You should go to http://gcc.gnu.org/bugzilla/ and http://llvm.org/bugs/fo=
r=20
> GCC and Clang, respectively.=20
>
> Also note that your program becomes valid if I add this function to=20
> another=20
> translation unit:=20
>
> void *operator new(size_t size)=20
> {=20
> return malloc(std::min(size, size_t(40000)));=20
> }=20
>
> Since the standard does allow you to override the global operator new,=20
> it's=20
> entirely possible possible for your program to be well-formed...=20
> --=20
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org=20
> Software Architect - Intel Open Source Technology Center=20
> PGP/GPG: 0x6EF45358; fingerprint:=20
> E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358=20
>
--=20
---=20
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 e=
mail 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-proposa=
ls/.
------=_Part_232_4229172.1394005382405
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Yes, I will push it to them. Thank you guys.<br><br>D=C5=
=88a streda, 5. marca 2014 8:30:20 UTC+1 Thiago Macieira nap=C3=ADsal(-a):<=
blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;bord=
er-left: 1px #ccc solid;padding-left: 1ex;">Em ter 04 mar 2014, =C3=A0s 14:=
47:56, Peter Bo=C4=8Dan escreveu:
<br>> build as: g++ -Wall -pedantic -Werror main.cpp has no syntac=
tical issues=20
<br>> and compiler does not warn treating a dynamic (POD !) variable as =
an=20
<br>> array... this "feature" will take down a program. Would it be poss=
ible to=20
<br>> have a warning/error statement, that this is not possible?=20
<br>>=20
<br>> Thanks folks, Peter Bocan.
<br>
<br>Yes, you can have it.
<br>
<br>But this list is the wrong place to ask for diagnostics from your compi=
ler.=20
<br>You should go to <a href=3D"http://gcc.gnu.org/bugzilla/" target=3D"_bl=
ank" onmousedown=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2=
Fgcc.gnu.org%2Fbugzilla%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNFcxoTt8GELTxJ=
TXhz_diPLdYC9sw';return true;" onclick=3D"this.href=3D'http://www.google.co=
m/url?q\75http%3A%2F%2Fgcc.gnu.org%2Fbugzilla%2F\46sa\75D\46sntz\0751\46usg=
\75AFQjCNFcxoTt8GELTxJTXhz_diPLdYC9sw';return true;">http://gcc.gnu.org/bug=
zilla/</a> and <a href=3D"http://llvm.org/bugs/" target=3D"_blank" onmoused=
own=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fllvm.org%2Fb=
ugs%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHmnzmFbwtsOwTPt_dSKY0IL8wN9Q';ret=
urn true;" onclick=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F=
%2Fllvm.org%2Fbugs%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHmnzmFbwtsOwTPt_dS=
KY0IL8wN9Q';return true;">http://llvm.org/bugs/</a> for=20
<br>GCC and Clang, respectively.
<br>
<br>Also note that your program becomes valid if I add this function to ano=
ther=20
<br>translation unit:
<br>
<br>void *operator new(size_t size)
<br>{
<br> return malloc(std::min(=
size, size_t(40000)));
<br>}
<br>
<br>Since the standard does allow you to override the global operator new, =
it's=20
<br>entirely possible possible for your program to be well-formed...
<br>--=20
<br>Thiago Macieira - thiago (AT) <a href=3D"http://macieira.info" target=
=3D"_blank" onmousedown=3D"this.href=3D'http://www.google.com/url?q\75http%=
3A%2F%2Fmacieira.info\46sa\75D\46sntz\0751\46usg\75AFQjCNEswDUBNCNanbu7euhq=
Ln_62FW8ag';return true;" onclick=3D"this.href=3D'http://www.google.com/url=
?q\75http%3A%2F%2Fmacieira.info\46sa\75D\46sntz\0751\46usg\75AFQjCNEswDUBNC=
Nanbu7euhqLn_62FW8ag';return true;">macieira.info</a> - thiago (AT) <a href=
=3D"http://kde.org" target=3D"_blank" onmousedown=3D"this.href=3D'http://ww=
w.google.com/url?q\75http%3A%2F%2Fkde.org\46sa\75D\46sntz\0751\46usg\75AFQj=
CNHGRJdo5_JYG1DowztwAHAKs80XSA';return true;" onclick=3D"this.href=3D'http:=
//www.google.com/url?q\75http%3A%2F%2Fkde.org\46sa\75D\46sntz\0751\46usg\75=
AFQjCNHGRJdo5_JYG1DowztwAHAKs80XSA';return true;">kde.org</a>
<br> Software Architect - Intel Open Source Technology Center
<br> PGP/GPG: 0x6EF45358; fingerprint:
<br> E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4=
5358
<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" 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_232_4229172.1394005382405--
.
Author: Bjorn Reese <breese@mail1.stofanet.dk>
Date: Wed, 05 Mar 2014 18:13:10 +0100
Raw View
On 03/05/2014 12:48 AM, Zhihao Yuan wrote:
> That's the exact reason we split observer_ptr into observer_ptr<T>
> and observer_ptr<T[]> and only support pointer arithmetic in the
> later one:
I apologize for digressing with bike-shedding, but the observer_ptr<>
name is unfortunate. An "observer" is usually associated with the
observer design pattern.
I think that a better name would be view_ptr (compare with string_view.)
--
---
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: Tony V E <tvaneerd@gmail.com>
Date: Wed, 5 Mar 2014 14:13:46 -0500
Raw View
--001a11c3fc82dfb2d104f3e0d169
Content-Type: text/plain; charset=ISO-8859-1
On Wed, Mar 5, 2014 at 12:13 PM, Bjorn Reese <breese@mail1.stofanet.dk>wrote:
> On 03/05/2014 12:48 AM, Zhihao Yuan wrote:
>
> That's the exact reason we split observer_ptr into observer_ptr<T>
>> and observer_ptr<T[]> and only support pointer arithmetic in the
>> later one:
>>
>
> I apologize for digressing with bike-shedding, but the observer_ptr<>
> name is unfortunate. An "observer" is usually associated with the
> observer design pattern.
>
> I think that a better name would be view_ptr (compare with string_view.)
>
>
>
Yes, view is probably better than observer. I noted the same exact thing
(ie that "observer" already has meaning) in the pre-meeting notes (for
Issaquah meeting). Not sure if it got discussed. I think Walter has
stopped worrying about naming - if/when the pointer ever gets finalized,
there will be a vote about the name.
Only question is where are we keeping the list of bike-shed colours.
Walter was keeping a list as part of the paper, but I'm not sure if he is
still interested in tracking more options.
My latest thought is something like "notmy_ptr" :-) I was thinking
"unowned_ptr", but hopefully it is owned, just not by me. "notmy_ptr"
reminds you that it is a bit unsafe.
The search continues...
Tony
--
---
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/.
--001a11c3fc82dfb2d104f3e0d169
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On Wed, Mar 5, 2014 at 12:13 PM, Bjorn Reese <span dir=3D"ltr"><=
<a href=3D"mailto:breese@mail1.stofanet.dk" target=3D"_blank">breese@mail1.=
stofanet.dk</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div class=3D"">On 03/05/2014 12:48 AM, Zhih=
ao Yuan wrote:<br>
<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
That's the exact reason we split observer_ptr into observer_ptr<T>=
;<br>
and observer_ptr<T[]> and only support pointer arithmetic in the<br>
later one:<br>
</blockquote>
<br></div>
I apologize for digressing with bike-shedding, but the observer_ptr<>=
<br>
name is unfortunate. An "observer" is usually associated with the=
<br>
observer design pattern.<br>
<br>
I think that a better name would be view_ptr (compare with string_view.)<di=
v class=3D"HOEnZb"><div><br>
<br></div></div></blockquote><div><br></div><div>Yes, view is probably bett=
er than observer.=A0 I noted the same exact thing (ie that "observer&q=
uot; already has meaning) in the pre-meeting notes (for Issaquah meeting).=
=A0 Not sure if it got discussed.=A0 I think Walter has stopped worrying ab=
out naming - if/when the pointer ever gets finalized, there will be a vote =
about the name.<br>
</div></div><br>Only question is where are we keeping the list of bike-shed=
colours.=A0 Walter was keeping a list as part of the paper, but I'm no=
t sure if he is still interested in tracking more options.<br><br></div><di=
v class=3D"gmail_extra">
My latest thought is something like "notmy_ptr" :-)=A0 I was thin=
king "unowned_ptr", but hopefully it is owned, just not by me.=A0=
"notmy_ptr" reminds you that it is a bit unsafe.<br><br>The sear=
ch continues...<br>
</div><div class=3D"gmail_extra">Tony<br></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" 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 />
--001a11c3fc82dfb2d104f3e0d169--
.
Author: Jeffrey Yasskin <jyasskin@google.com>
Date: Wed, 5 Mar 2014 11:18:17 -0800
Raw View
The best way to make sure we discuss the name is to write a survey
paper describing pros and cons of some alternatives. I'm kind of
partial to observer_ptr (though view_ptr isn't bad), and also to not
talking much about the name, but we'll definitely have a bikeshed vote
in Rapperswil if there's interest.
On Wed, Mar 5, 2014 at 11:13 AM, Tony V E <tvaneerd@gmail.com> wrote:
>
>
>
> On Wed, Mar 5, 2014 at 12:13 PM, Bjorn Reese <breese@mail1.stofanet.dk>
> wrote:
>>
>> On 03/05/2014 12:48 AM, Zhihao Yuan wrote:
>>
>>> That's the exact reason we split observer_ptr into observer_ptr<T>
>>> and observer_ptr<T[]> and only support pointer arithmetic in the
>>> later one:
>>
>>
>> I apologize for digressing with bike-shedding, but the observer_ptr<>
>> name is unfortunate. An "observer" is usually associated with the
>> observer design pattern.
>>
>> I think that a better name would be view_ptr (compare with string_view.)
>>
>>
>
> Yes, view is probably better than observer. I noted the same exact thing
> (ie that "observer" already has meaning) in the pre-meeting notes (for
> Issaquah meeting). Not sure if it got discussed. I think Walter has
> stopped worrying about naming - if/when the pointer ever gets finalized,
> there will be a vote about the name.
>
> Only question is where are we keeping the list of bike-shed colours. Walter
> was keeping a list as part of the paper, but I'm not sure if he is still
> interested in tracking more options.
>
> My latest thought is something like "notmy_ptr" :-) I was thinking
> "unowned_ptr", but hopefully it is owned, just not by me. "notmy_ptr"
> reminds you that it is a bit unsafe.
>
> The search continues...
> Tony
>
> --
>
> ---
> 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/.
.
Author: Tony V E <tvaneerd@gmail.com>
Date: Wed, 5 Mar 2014 14:22:35 -0500
Raw View
--001a11c3fba266b94204f3e0f107
Content-Type: text/plain; charset=ISO-8859-1
On Wed, Mar 5, 2014 at 2:18 PM, Jeffrey Yasskin <jyasskin@google.com> wrote:
> The best way to make sure we discuss the name is to write a survey
> paper describing pros and cons of some alternatives. I'm kind of
> partial to observer_ptr (though view_ptr isn't bad), and also to not
> talking much about the name, but we'll definitely have a bikeshed vote
> in Rapperswil if there's interest.
>
>
Are we expecting to review observer_ptr again at Rapperswil, beyond
bikeshedding? (Maybe this is a question for Walter?)
ie we should only decide the name if/when we decide that it is going in.
No sense bikeshedding otherwise.
Tony
--
---
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/.
--001a11c3fba266b94204f3e0f107
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On Wed, Mar 5, 2014 at 2:18 PM, Jeffrey Yasskin <span dir=3D"ltr">&=
lt;<a href=3D"mailto:jyasskin@google.com" target=3D"_blank">jyasskin@google=
..com</a>></span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">The best way to make sure we discuss the nam=
e is to write a survey<br>
paper describing pros and cons of some alternatives. I'm kind of<br>
partial to observer_ptr (though view_ptr isn't bad), and also to not<br=
>
talking much about the name, but we'll definitely have a bikeshed vote<=
br>
in Rapperswil if there's interest.<br>
<div class=3D"HOEnZb"><div class=3D"h5"><br></div></div></blockquote><div><=
br></div></div>Are we expecting to review observer_ptr again at Rapperswil,=
beyond bikeshedding?=A0 (Maybe this is a question for Walter?)<br><br></di=
v>
<div class=3D"gmail_extra">ie we should only decide the name if/when we dec=
ide that it is going in.=A0 No sense bikeshedding otherwise.<br><br></div><=
div class=3D"gmail_extra">Tony<br></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" 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 />
--001a11c3fba266b94204f3e0f107--
.
Author: Zhihao Yuan <zy@miator.net>
Date: Wed, 5 Mar 2014 14:52:38 -0500
Raw View
On Wed, Mar 5, 2014 at 2:22 PM, Tony V E <tvaneerd@gmail.com> wrote:
>
> Are we expecting to review observer_ptr again at Rapperswil, beyond
> bikeshedding? (Maybe this is a question for Walter?)
>
> ie we should only decide the name if/when we decide that it is going in. No
> sense bikeshedding otherwise.
I don't think we suggested any change. One of the polls shows some
consensus about observer_ptr<T[]> -> observer_iterator<T>, but Eric
(who raised this topic) himself agreed with "model shared_ptr and
unique_ptr as much as possible" later.
So I assume the next step is wording review.
--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
___________________________________________________
4BSD -- http://4bsd.biz/
--
---
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: Jeffrey Yasskin <jyasskin@google.com>
Date: Wed, 5 Mar 2014 12:00:43 -0800
Raw View
On Wed, Mar 5, 2014 at 11:22 AM, Tony V E <tvaneerd@gmail.com> wrote:
>
>
>
> On Wed, Mar 5, 2014 at 2:18 PM, Jeffrey Yasskin <jyasskin@google.com> wrote:
>>
>> The best way to make sure we discuss the name is to write a survey
>> paper describing pros and cons of some alternatives. I'm kind of
>> partial to observer_ptr (though view_ptr isn't bad), and also to not
>> talking much about the name, but we'll definitely have a bikeshed vote
>> in Rapperswil if there's interest.
>>
>
> Are we expecting to review observer_ptr again at Rapperswil, beyond
> bikeshedding? (Maybe this is a question for Walter?)
>
> ie we should only decide the name if/when we decide that it is going in. No
> sense bikeshedding otherwise.
I believe we wanted two small changes, "taking out the N, and putting
some design rational in the document", and didn't have other strong
preferences: http://wiki.edg.com/twiki/bin/view/Wg21issaquah/N3840.
Assuming Walter produces a paper with those changes before Rapperswil
(and given that LEWG's basically happy with the proposal, the design
rationale is probably optional in practice), I'm planning to take a
straw poll on c++std-lib-ext, and if that comes out positive, put the
paper on the consent agenda to forward to LWG Monday for inclusion in
Lib Fundamentals V2.
So now's a good time to propose the bikeshed, but you should also have
time after Rapperswil to write a paper proposing to *change* the name
after it's in the TS draft. I'm kind of informally tracking which
proposals have had their naming bikeshed, and while we pruned the
observer_ptr names in Chicago, we didn't have an actual vote about
what we preferred, so I'd be reasonably happy to structure the first
such discussion as "pick a name" without a bias in favor of the
status-quo, at least within LEWG, as long as it's proposed fairly
soon. (The committee vote will have such a bias, but they're likely to
accept the LEWG's recommendation.)
--
---
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: Jeffrey Yasskin <jyasskin@google.com>
Date: Wed, 5 Mar 2014 12:06:41 -0800
Raw View
On Wed, Mar 5, 2014 at 12:00 PM, Jeffrey Yasskin <jyasskin@google.com> wrote:
> (and given that LEWG's basically happy with the proposal, the design
> rationale is probably optional in practice)
Oh, now I remember: The design rationale is primarily so that the LWG
can make sure that the wording accurately implements Walter's and
LEWG's goals for the class. So it is pretty important for forwarding
to LWG.
--
---
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: Thiago Macieira <thiago@macieira.org>
Date: Tue, 04 Mar 2014 14:58:09 -0800
Raw View
Em ter 04 mar 2014, =C3=A0s 14:47:56, Peter Bo=C4=8Dan escreveu:
> build as: g++ -Wall -pedantic -Werror main.cpp has no syntactical issues=
=20
> and compiler does not warn treating a dynamic (POD !) variable as an=20
> array... this "feature" will take down a program. Would it be possible to=
=20
> have a warning/error statement, that this is not possible?=20
>=20
> Thanks folks, Peter Bocan.
Yes, you can have it.
But this list is the wrong place to ask for diagnostics from your compiler.=
=20
You should go to http://gcc.gnu.org/bugzilla/ and http://llvm.org/bugs/ for=
=20
GCC and Clang, respectively.
Also note that your program becomes valid if I add this function to another=
=20
translation unit:
void *operator new(size_t size)
{
return malloc(std::min(size, size_t(40000)));
}
Since the standard does allow you to override the global operator new, it's=
=20
entirely possible possible for your program to be well-formed...
--=20
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
--=20
---=20
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 e=
mail 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-proposa=
ls/.
.