[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

pl.comp.programming

NULL zdefiniowane czy nie w C++ ??

Megas

3/5/2007 10:26:00 AM

Witam,

Czy moze ktos spotkal sie z twierdzeniem, ze wartosc NULL formalnie nie jest
zdefiniowana w C++ (przeciwienstwie do C) i nie nalezy jej uzywac tylko
zdefiniowac wlasna stala a'la NULL, np. #define NILL 0.

Pozdr
Marcin


6 Answers

Jedrzej Dudkiewicz

3/5/2007 11:37:00 AM

0

> Czy moze ktos spotkal sie z twierdzeniem, ze wartosc NULL formalnie nie
jest
> zdefiniowana w C++ (przeciwienstwie do C) i nie nalezy jej uzywac tylko
> zdefiniowac wlasna stala a'la NULL, np. #define NILL 0.

S3ysza3em. Standard C++ mówi:
C.2.2.3 Macro NULL [diff.null]

1 The macro NULL, defined in any of <clocale>, <cstddef>, <cstdio>,
<cstdlib>, <cstring>,

<ctime>, or <cwchar>, is an implementation-defined C + + null pointer
constant in this International

Standard (18.1).



JD



Megas

3/5/2007 12:15:00 PM

0


U¿ytkownik "Jedrzej Dudkiewicz" <jedrzej.dudkiewicz@poczta.interia.pl>
napisa³ w wiadomo¶ci news:esgvg2$pre$1@news.supermedia.pl...
> S³ysza³em. Standard C++ mówi:
> C.2.2.3 Macro NULL [diff.null]
>
> 1 The macro NULL, defined in any of <clocale>, <cstddef>, <cstdio>,
> <cstdlib>, <cstring>,
>
> <ctime>, or <cwchar>, is an implementation-defined C + + null pointer
> constant in this International
>
> Standard (18.1).

Co to za standard i gdzie moge go znalesc?


SirMike

3/5/2007 1:15:00 PM

0

Dnia Mon, 5 Mar 2007 13:14:39 +0100, Marcin O. napisa3(a):

> U?ytkownik "Jedrzej Dudkiewicz" <jedrzej.dudkiewicz@poczta.interia.pl>
> napisa3 w wiadomo?ci news:esgvg2$pre$1@news.supermedia.pl...
>> S3ysza3em. Standard C++ mówi:
>> C.2.2.3 Macro NULL [diff.null]
>>
>> 1 The macro NULL, defined in any of <clocale>, <cstddef>, <cstdio>,
>> <cstdlib>, <cstring>,
>>
>> <ctime>, or <cwchar>, is an implementation-defined C + + null pointer
>> constant in this International
>>
>> Standard (18.1).
>
> Co to za standard i gdzie moge go znalesc?

Standard C++ po prostu :)
http://www.open-std.org/jtc1/...

--
SirMike - http://www.s...

C makes it easy to shoot yourself in the foot; C++ makes it harder, but
when you do, it blows away your whole leg. - Bjarne Stroustrup

Megas

3/5/2007 1:37:00 PM

0


U¿ytkownik "SirMike" <sirmike@FUCKSPAMMERSpoczta.onet.pl> napisa³ w
wiadomo¶ci news:1q1rztb6gxl1l$.cwux81djxb6.dlg@40tude.net...
>
> Standard C++ po prostu :)
> http://www.open-std.org/jtc1/...
>

Wchodze i sie gubie... Rozumiem, ze ostatnia aktualana wersja Standardu C++
to C++ Standard Core Language Issues List ? Jesli tak, to dlaczego lista
poszczegolnych standardow nie idzie po kolei, mam wrazenie ze to jest lista
poprawek w stosunku do poprzedniej wersji. A gdzie jest pelna lista ?+


Segmentation Fault

3/5/2007 7:15:00 PM

0

Jedrzej Dudkiewicz wrote:
>> Czy moze ktos spotkal sie z twierdzeniem, ze wartosc NULL formalnie nie
> jest
>> zdefiniowana w C++ (przeciwienstwie do C) i nie nalezy jej uzywac tylko
>> zdefiniowac wlasna stala a'la NULL, np. #define NILL 0.
>
> S3ysza3em. Standard C++ mówi:
> C.2.2.3 Macro NULL [diff.null]
>
> 1 The macro NULL, defined in any of <clocale>, <cstddef>, <cstdio>,
> <cstdlib>, <cstring>,
>
> <ctime>, or <cwchar>, is an implementation-defined C + + null pointer
> constant in this International
>
> Standard (18.1).
>

Tak dla równowagi ;)


Should I use NULL or 0?
In C++, the definition of NULL is 0, so there is only an aesthetic
difference. I prefer to avoid macros, so I use 0. Another problem with
NULL is that people sometimes mistakenly believe that it is different
from 0 and/or not an integer. In pre-standard code, NULL was/is
sometimes defined to something unsuitable and therefore had/has to be
avoided. That's less common these days.

If you have to name the null pointer, call it nullptr; that's what it's
going to be called in C++0x. Then, "nullptr" will be a keyword.

(Bjarne Stroustrup)

http://www.research.att.com/~bs/bs_faq2...

Bronek Kozicki

3/5/2007 9:00:00 PM

0

Marcin O. wrote:
> U¿ytkownik "SirMike" <sirmike@FUCKSPAMMERSpoczta.onet.pl> napisa³ w
> wiadomo¶ci news:1q1rztb6gxl1l$.cwux81djxb6.dlg@40tude.net...
>> Standard C++ po prostu :)
>> http://www.open-std.org/jtc1/...
>>
>
> Wchodze i sie gubie... Rozumiem, ze ostatnia aktualana wersja Standardu C++
> to C++ Standard Core Language Issues List ? Jesli tak, to dlaczego lista

nie. Ten link powyżej to witryna komitetu ISO który zajmuje siÄ?
standardem jÄ?zyka C++ . Ta konkretna lista to sprawy które komitet
rozważa do naprawienia w kolejnej edycji standardu jÄ?zyka C++
(popularnie nazywanej "C++0x" ). To o co pytaÅ?eÅ? to norma ISO 14882:2003
, do kupienia za (chyba) $30 w sklepie internetowym ANSI (jako PDF na
osobÄ? prywatnÄ?). Możesz też go znaleźÄ? w postaci drukowanej, ISBN
0470846747, wydawnictwo Wiley and Sons Ltd 2003 . Standard C++ jest
ostatecznym punktem odniesienia w sprawach dotyczÄ?cych jÄ?zyka C++ .


B.


--
Remove -trap- when replying. Usun -trap- gdy odpisujesz.