Usenet.com

www.Usenet.com

Group Index

Comp Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

Re: What's wrong with this?



Gianni Mariani <[EMAIL PROTECTED]> schrieb in im Newsbeitrag:
[EMAIL PROTECTED]
> Joe Developer wrote:

[snip]

>
> As a test, try this:
>
> template <typename T> void foo( T v )
> {
>     char * x = v;
>     x[0] = '9';
> }
>
> int main()
> {
>      foo( "Hello World" );
> }
>

This should result in

void foo( const char* v )
{
    char * x = v; // Assign const char* to char* - error?
}

What does the standard say about this? I guess that this should cause an
error!

Greetz,

Matthias




      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]



<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.