-
January 8th, 2009, 02:34 PM
#1
strerror deprecated?
Hello,
In Windows I get:
warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS.
When I try to compile this line:
cerr << "ERROR: recvfrom(): " << strerror(errno) << endl;
I know its not deprecated, but is there a better function to do what I am trying to do? One without warnings?
Thanks!
-
January 8th, 2009, 02:36 PM
#2
Re: strerror deprecated?
I would say just disable those warnings, but that's just me......
-
January 8th, 2009, 02:42 PM
#3
Re: strerror deprecated?
this is for a library that people will compile on other machines though.. so I was looking for a way for them not to have warnings.. you know?
-
January 8th, 2009, 02:46 PM
#4
Re: strerror deprecated?
by the way Lindley.. do you know if cerr is ok to use for all applications? like windows console, dialog based apps, etc?
-
January 8th, 2009, 02:46 PM
#5
Re: strerror deprecated?
Originally Posted by lab1
this is for a library that people will compile on other machines though.. so I was looking for a way for them not to have warnings.. you know?
Provide them with project configuration files such that the warning is disabled.
-
January 8th, 2009, 03:12 PM
#6
Re: strerror deprecated?
Originally Posted by laserlight
Provide them with project configuration files such that the warning is disabled.
If COMPILER portability is not a major concern, I would recommend push/pop around those cases where you specifically KNOW it is safe....
For example the posted code is NOT thread safe, while the recommended replacement IS.
The ONLY time I deiable the warning (or use the #define to accomplish the same thing) is when I have a large codebase provided by another vendor that I am not going to be making (significant) modifications to....
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|