On 01/24/14 20:15, Dimitry Sibiryakov wrote:
>     Hello, All.
>
>     At first glance subj is not a big deal, but C++ language is moving toward 
> strict type
> checking and on this way a problem appear: how to initialize variables? NULL 
> cannot be
> assigned to integers (well, it can, but produce annoying warning in current 
> versions and
> may be prohibited in future ones), 0 cannot be assigned to pointers.

That sounds strange to me.

void f()
{
     char* ptr = 0;
}

# g++ -Wall f.cpp -c
f.cpp: In function 'void f()':
f.cpp:3:8: warning: unused variable 'ptr' [-Wunused-variable]

I.e. all warnings turned on, but nothing bad is said about 0 assigned to 
pointer.
And that's correct, cause in classic C++ book from Stroustrup it's 
explicitly mentioned that 0 is specific constant which may be converted 
to any simple type.

fbs firebird # g++ --version
g++ (Gentoo 4.7.3-r1 p1.3, pie-0.5.5) 4.7.3

What compiler do you talk about?


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to