strtol exceptions

N

Niels Dybdahl

Does strtol raise any exceptions?

It probably throws a null-pointer exception if one of the parameters is
NULL. If it runs out of memory it probably throws some other exception.

Niels Dybdahl
 
A

Attila Feher

Niels said:
It probably throws a null-pointer exception if one of the parameters
is NULL. If it runs out of memory it probably throws some other
exception.

It is a C library function. Thereforw it throws no exceptions, since there
are no exceptions in C.

Furtermore there is no "null-pointer exception" in standard C or C++.

In addition - as I can see - strol() does not need to allocate memory, so it
is unlikely that it does.

http://www.dinkumware.com/manuals/reader.aspx?b=p/&h=stdlib.html#strtol
 
R

Ron Natalie

Niels Dybdahl said:
It probably throws a null-pointer exception if one of the parameters is
NULL. If it runs out of memory it probably throws some other exception.
It throws no C++ exception. There is no such thing as a "null-pointer" exception
in C++ and the bad_alloc exception is not required to be used by strtol.
 
P

Pete Becker

Niels said:
It probably throws a null-pointer exception if one of the parameters is
NULL.

You're thinking of Java, which doesn't have pointers but does have a
null pointer exception.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top