Topic: sizeof operator
Author: AJAY SAINI <saini.ajay172@gmail.com>
Date: Mon, 14 Sep 2015 20:10:46 +0530
Raw View
--001a113438ee05e6fd051fb60dc6
Content-Type: text/plain; charset=UTF-8
The *sizeof *operator must be able to return memory occupied an array in
every function in which it is passed.
[code]
#include<bits/stdc++.h>
using namespace std;
int fun(int a[]){
int s = sizeof(a)/sizeof(a[0]);
return s;
}
int main(){
int s[5];
int size = sizeof(s)/sizeof(s[0]);
cout << size << endl;
cout << fun(s) << endl;
return 0;
}
[code]
In the above code's output must be same in both in lines.
--
---
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/.
--001a113438ee05e6fd051fb60dc6
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">The <b>sizeof </b>operator must be able to return memory o=
ccupied an array in every function in which it is passed.<div>[code]</div><=
div><div>#include<bits/stdc++.h></div><div><br></div><div>using names=
pace std;</div><div><br></div><div>int fun(int a[]){</div><div>=C2=A0 =C2=
=A0 int s =3D sizeof(a)/sizeof(a[0]);</div><div>=C2=A0 =C2=A0 return s;</di=
v><div>}</div><div>int main(){</div><div>=C2=A0 =C2=A0 int s[5];</div><div>=
=C2=A0 =C2=A0 int size =3D sizeof(s)/sizeof(s[0]);</div><div>=C2=A0 =C2=A0 =
cout << size << endl;</div><div>=C2=A0 =C2=A0 cout << fun=
(s) << endl;</div><div>=C2=A0 =C2=A0 return 0;</div><div>}</div></div=
><div>[code]</div><div>In the above code's output must be same in both =
in lines.</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 />
--001a113438ee05e6fd051fb60dc6--
.
Author: Brent Friedman <fourthgeek@gmail.com>
Date: Mon, 14 Sep 2015 10:03:49 -0500
Raw View
--001a113d37c8718f81051fb65ff3
Content-Type: text/plain; charset=UTF-8
Doing this would break C compatibility as well as a large number of
language constructs and break tons of existing code.
If you pass the array size to fun then it can work in the language as-is
currently. Use a reference-to-array.
template<size_t N>
int fun(int (&a)[N])
An alternative which has been quite popular is to not use C-style arrays.
Use std::array.
template<size_t N>
int fun( std::array<int, N>& a)
On Mon, Sep 14, 2015 at 9:40 AM, AJAY SAINI <saini.ajay172@gmail.com> wrote:
> The *sizeof *operator must be able to return memory occupied an array in
> every function in which it is passed.
> [code]
> #include<bits/stdc++.h>
>
> using namespace std;
>
> int fun(int a[]){
> int s = sizeof(a)/sizeof(a[0]);
> return s;
> }
> int main(){
> int s[5];
> int size = sizeof(s)/sizeof(s[0]);
> cout << size << endl;
> cout << fun(s) << endl;
> return 0;
> }
> [code]
> In the above code's output must be same in both in lines.
>
> --
>
> ---
> 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/.
--001a113d37c8718f81051fb65ff3
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Doing this would break C compatibility as well as a large =
number of language constructs and break tons of existing code.<div><br></di=
v><div>If you pass the array size to fun then it can work in the language a=
s-is currently. Use a reference-to-array.</div><div><br></div><div>template=
<size_t N></div><div>int fun(int (&a)[N])</div><div><br></div><di=
v>An alternative which has been quite popular is to not use C-style arrays.=
Use std::array.</div><div><br></div><div>template<size_t N></div><di=
v>int fun( std::array<int, N>& a)</div><div><br></div></div><div =
class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Mon, Sep 14, 2015 a=
t 9:40 AM, AJAY SAINI <span dir=3D"ltr"><<a href=3D"mailto:saini.ajay172=
@gmail.com" target=3D"_blank">saini.ajay172@gmail.com</a>></span> wrote:=
<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-lef=
t:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">The <b>sizeof </b>opera=
tor must be able to return memory occupied an array in every function in wh=
ich it is passed.<div>[code]</div><div><div>#include<bits/stdc++.h></=
div><div><br></div><div>using namespace std;</div><div><br></div><div>int f=
un(int a[]){</div><div>=C2=A0 =C2=A0 int s =3D sizeof(a)/sizeof(a[0]);</div=
><div>=C2=A0 =C2=A0 return s;</div><div>}</div><div>int main(){</div><div>=
=C2=A0 =C2=A0 int s[5];</div><div>=C2=A0 =C2=A0 int size =3D sizeof(s)/size=
of(s[0]);</div><div>=C2=A0 =C2=A0 cout << size << endl;</div><d=
iv>=C2=A0 =C2=A0 cout << fun(s) << endl;</div><div>=C2=A0 =C2=
=A0 return 0;</div><div>}</div></div><div>[code]</div><div>In the above cod=
e's output must be same in both in lines.</div></div><span class=3D"HOE=
nZb"><font color=3D"#888888">
<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" 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>
</font></span></blockquote></div><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" 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 />
--001a113d37c8718f81051fb65ff3--
.
Author: Thiago Macieira <thiago@macieira.org>
Date: Mon, 14 Sep 2015 18:58:47 -0700
Raw View
On Monday 14 September 2015 20:10:46 AJAY SAINI wrote:
> In the above code's output must be same in both in lines.
It isn't because int a[] decays to int *a.
What's your proposal?
Please take into account that the committee has already rejected the most
advanced and complex parts of C99 Variable Length Arrays.
--
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: Tue, 15 Sep 2015 12:03:56 +0800
Raw View
--Apple-Mail=_B3D11ED2-6741-40C9-B7E7-F8D127B6D72C
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8
> On 2015=E2=80=9309=E2=80=9315, at 9:58 AM, Thiago Macieira <thiago@maciei=
ra.org> wrote:
>=20
> Please take into account that the committee has already rejected the most=
=20
> advanced and complex parts of C99 Variable Length Arrays.
Translation: The committee has explicitly rejected the idea of any aspect o=
f sizeof ever being evaluated at runtime, even given new types.
--=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/.
--Apple-Mail=_B3D11ED2-6741-40C9-B7E7-F8D127B6D72C
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><br class=3D""><di=
v><blockquote type=3D"cite" class=3D""><div class=3D"">On 2015=E2=80=9309=
=E2=80=9315, at 9:58 AM, Thiago Macieira <<a href=3D"mailto:thiago@macie=
ira.org" class=3D"">thiago@macieira.org</a>> wrote:</div><br class=3D"Ap=
ple-interchange-newline"><div class=3D""><span style=3D"font-family: Helvet=
ica; font-size: 12px; font-style: normal; font-variant: normal; font-weight=
: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-=
align: start; text-indent: 0px; text-transform: none; white-space: normal; =
widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: non=
e; display: inline !important;" class=3D"">Please take into account that th=
e committee has already rejected the most<span class=3D"Apple-converted-spa=
ce"> </span></span><br style=3D"font-family: Helvetica; font-size: 12p=
x; font-style: normal; font-variant: normal; font-weight: normal; letter-sp=
acing: normal; line-height: normal; orphans: auto; text-align: start; text-=
indent: 0px; text-transform: none; white-space: normal; widows: auto; word-=
spacing: 0px; -webkit-text-stroke-width: 0px;" class=3D""><span style=3D"fo=
nt-family: Helvetica; font-size: 12px; font-style: normal; font-variant: no=
rmal; font-weight: normal; letter-spacing: normal; line-height: normal; orp=
hans: auto; text-align: start; text-indent: 0px; text-transform: none; whit=
e-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width=
: 0px; float: none; display: inline !important;" class=3D"">advanced and co=
mplex parts of C99 Variable Length Arrays.</span><br style=3D"font-family: =
Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-=
weight: normal; letter-spacing: normal; line-height: normal; orphans: auto;=
text-align: start; text-indent: 0px; text-transform: none; white-space: no=
rmal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" cla=
ss=3D""></div></blockquote></div><br class=3D""><div class=3D"">Translation=
: The committee has explicitly rejected the idea of any aspect of <font fac=
e=3D"Courier" class=3D"">sizeof</font> ever being evaluated at runtime, eve=
n given new types.</div><div class=3D""><br class=3D""></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" 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=_B3D11ED2-6741-40C9-B7E7-F8D127B6D72C--
.
Author: =?UTF-8?Q?David_Rodr=C3=ADguez_Ibeas?= <dibeas@ieee.org>
Date: Tue, 15 Sep 2015 10:54:30 +0100
Raw View
--f46d0442807e1a696a051fc62b85
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
A more interesting proposal, although an impossible one, would be to break
compatibility with C completely and drop the decay in function signatures,
forcing the user to type the real signature: 'int fun(int *a)' at which
point it becomes clear why 'sizeof' cannot work inside the function.
That being an impossibility, I do recommend spelling the arguments to
functions as what they really mean to the compiler to avoid this kind of
misunderstanding. Specially for those coming from languages where String[]
represent an array of any size and the size is only known at runtime.
void fun(int *a) {}
void call( void (*fn)() ) { fn(); }
On Tue, Sep 15, 2015 at 5:03 AM, David Krauss <potswa@gmail.com> wrote:
>
> On 2015=E2=80=9309=E2=80=9315, at 9:58 AM, Thiago Macieira <thiago@maciei=
ra.org> wrote:
>
> Please take into account that the committee has already rejected the most
> advanced and complex parts of C99 Variable Length Arrays.
>
>
> Translation: The committee has explicitly rejected the idea of any aspect
> of sizeof ever being evaluated at runtime, even given new types.
>
> --
>
> ---
> 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/.
>
--=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/.
--f46d0442807e1a696a051fc62b85
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">A more interesting proposal, although an impossible one, w=
ould be to break compatibility with C completely and drop the decay in func=
tion signatures, forcing the user to type the real signature: 'int fun(=
int *a)' at which point it becomes clear why 'sizeof' cannot wo=
rk inside the function.<br><br>That being an impossibility, I do recommend =
spelling the arguments to functions as what they really mean to the compile=
r to avoid this kind of misunderstanding. Specially for those coming from l=
anguages where String[] represent an array of any size and the size is only=
known at runtime.<br><br>void fun(int *a) {}<br>void call( void (*fn)() ) =
{ fn(); }</div><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On=
Tue, Sep 15, 2015 at 5:03 AM, David Krauss <span dir=3D"ltr"><<a href=
=3D"mailto:potswa@gmail.com" target=3D"_blank">potswa@gmail.com</a>></sp=
an> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;=
border-left:1px #ccc solid;padding-left:1ex"><div style=3D"word-wrap:break-=
word"><span class=3D""><br><div><blockquote type=3D"cite"><div>On 2015=E2=
=80=9309=E2=80=9315, at 9:58 AM, Thiago Macieira <<a href=3D"mailto:thia=
go@macieira.org" target=3D"_blank">thiago@macieira.org</a>> wrote:</div>=
<br><div><span style=3D"font-family:Helvetica;font-size:12px;font-style:nor=
mal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-heigh=
t:normal;text-align:start;text-indent:0px;text-transform:none;white-space:n=
ormal;word-spacing:0px;float:none;display:inline!important">Please take int=
o account that the committee has already rejected the most<span>=C2=A0</spa=
n></span><br style=3D"font-family:Helvetica;font-size:12px;font-style:norma=
l;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:=
normal;text-align:start;text-indent:0px;text-transform:none;white-space:nor=
mal;word-spacing:0px"><span style=3D"font-family:Helvetica;font-size:12px;f=
ont-style:normal;font-variant:normal;font-weight:normal;letter-spacing:norm=
al;line-height:normal;text-align:start;text-indent:0px;text-transform:none;=
white-space:normal;word-spacing:0px;float:none;display:inline!important">ad=
vanced and complex parts of C99 Variable Length Arrays.</span><br style=3D"=
font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;=
font-weight:normal;letter-spacing:normal;line-height:normal;text-align:star=
t;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">=
</div></blockquote></div><br></span><div>Translation: The committee has exp=
licitly rejected the idea of any aspect of <font face=3D"Courier">sizeof</f=
ont> ever being evaluated at runtime, even given new types.</div><div><br><=
/div></div><div class=3D"HOEnZb"><div class=3D"h5">
<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" 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>
</div></div></blockquote></div><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" 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 />
--f46d0442807e1a696a051fc62b85--
.
Author: =?UTF-8?Q?David_Rodr=C3=ADguez_Ibeas?= <dibeas@ieee.org>
Date: Tue, 15 Sep 2015 10:55:35 +0100
Raw View
--001a11c2283af70452051fc62e9e
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Just to be clear: I am not suggesting doing this, and it would not only
drop compatibility with C, but also with all existing C++.
The recommendation to spell the right types in function signatures stands.
On Tue, Sep 15, 2015 at 10:54 AM, David Rodr=C3=ADguez Ibeas <dibeas@ieee.o=
rg>
wrote:
> A more interesting proposal, although an impossible one, would be to brea=
k
> compatibility with C completely and drop the decay in function signatures=
,
> forcing the user to type the real signature: 'int fun(int *a)' at which
> point it becomes clear why 'sizeof' cannot work inside the function.
>
> That being an impossibility, I do recommend spelling the arguments to
> functions as what they really mean to the compiler to avoid this kind of
> misunderstanding. Specially for those coming from languages where String[=
]
> represent an array of any size and the size is only known at runtime.
>
> void fun(int *a) {}
> void call( void (*fn)() ) { fn(); }
>
> On Tue, Sep 15, 2015 at 5:03 AM, David Krauss <potswa@gmail.com> wrote:
>
>>
>> On 2015=E2=80=9309=E2=80=9315, at 9:58 AM, Thiago Macieira <thiago@macie=
ira.org> wrote:
>>
>> Please take into account that the committee has already rejected the mos=
t
>>
>> advanced and complex parts of C99 Variable Length Arrays.
>>
>>
>> Translation: The committee has explicitly rejected the idea of any aspec=
t
>> of sizeof ever being evaluated at runtime, even given new types.
>>
>> --
>>
>> ---
>> You received this message because you are subscribed to the Google Group=
s
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n
>> 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/.
>>
>
>
--=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/.
--001a11c2283af70452051fc62e9e
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Just to be clear: I am not suggesting doing this, and it w=
ould not only drop compatibility with C, but also with all existing C++.<br=
><br>The recommendation to spell the right types in function signatures sta=
nds.</div><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Tue,=
Sep 15, 2015 at 10:54 AM, David Rodr=C3=ADguez Ibeas <span dir=3D"ltr"><=
;<a href=3D"mailto:dibeas@ieee.org" target=3D"_blank">dibeas@ieee.org</a>&g=
t;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0=
.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">A more =
interesting proposal, although an impossible one, would be to break compati=
bility with C completely and drop the decay in function signatures, forcing=
the user to type the real signature: 'int fun(int *a)' at which po=
int it becomes clear why 'sizeof' cannot work inside the function.<=
br><br>That being an impossibility, I do recommend spelling the arguments t=
o functions as what they really mean to the compiler to avoid this kind of =
misunderstanding. Specially for those coming from languages where String[] =
represent an array of any size and the size is only known at runtime.<br><b=
r>void fun(int *a) {}<br>void call( void (*fn)() ) { fn(); }</div><div clas=
s=3D"HOEnZb"><div class=3D"h5"><div class=3D"gmail_extra"><br><div class=3D=
"gmail_quote">On Tue, Sep 15, 2015 at 5:03 AM, David Krauss <span dir=3D"lt=
r"><<a href=3D"mailto:potswa@gmail.com" target=3D"_blank">potswa@gmail.c=
om</a>></span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"marg=
in:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style=3D"wo=
rd-wrap:break-word"><span><br><div><blockquote type=3D"cite"><div>On 2015=
=E2=80=9309=E2=80=9315, at 9:58 AM, Thiago Macieira <<a href=3D"mailto:t=
hiago@macieira.org" target=3D"_blank">thiago@macieira.org</a>> wrote:</d=
iv><br><div><span style=3D"font-family:Helvetica;font-size:12px;font-style:=
normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-he=
ight:normal;text-align:start;text-indent:0px;text-transform:none;white-spac=
e:normal;word-spacing:0px;float:none;display:inline!important">Please take =
into account that the committee has already rejected the most<span>=C2=A0</=
span></span><br style=3D"font-family:Helvetica;font-size:12px;font-style:no=
rmal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-heig=
ht:normal;text-align:start;text-indent:0px;text-transform:none;white-space:=
normal;word-spacing:0px"><span style=3D"font-family:Helvetica;font-size:12p=
x;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:n=
ormal;line-height:normal;text-align:start;text-indent:0px;text-transform:no=
ne;white-space:normal;word-spacing:0px;float:none;display:inline!important"=
>advanced and complex parts of C99 Variable Length Arrays.</span><br style=
=3D"font-family:Helvetica;font-size:12px;font-style:normal;font-variant:nor=
mal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:=
start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0=
px"></div></blockquote></div><br></span><div>Translation: The committee has=
explicitly rejected the idea of any aspect of <font face=3D"Courier">sizeo=
f</font> ever being evaluated at runtime, even given new types.</div><div><=
br></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" 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>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><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" 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 />
--001a11c2283af70452051fc62e9e--
.