473,396 Members | 1,998 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Correct use of _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES?

I am using the #define for _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES in my
Windows MFC App, (Visual Studio 2005) and yet continue to receive compiler
warnings about various CRT functions.

It was my impression that setting the #define of
_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES to 1 would automatically adjust the
old CRT function calls I had in my code to accommodate the new size-checking
format. However, when I step through the code in debug, it appears to step
into the older unsafe CRT function.

My stdafx.h file has the following defined at the very bottom:

//---------------------------------------
// The following #defines ensure that safe CRT functions are automatically
used.
#undef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES
#undef _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT
#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT 1
//----------------------------------------

And when I display the value at runtime, it shows the correct value:

m_util.OutputDebugString(_T("_CRT_SECURE_CPP_OVERL OAD_STANDARD_NAMES=%d"),_CRT_SECURE_CPP_OVERLOAD_S TANDARD_NAMES);

So why, when I compile, do I still get the compiler warnings, and why, when
I step through a CRT function, is it still stepping into the old function?

Thanks!
Mark
Mar 4 '07 #1
2 5167
>I am using the #define for _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES in my
>Windows MFC App, (Visual Studio 2005) and yet continue to receive compiler
warnings about various CRT functions.

It was my impression that setting the #define of
_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES to 1 would automatically adjust the
old CRT function calls I had in my code to accommodate the new size-checking
format.
Mark,

It'll do it for those situations where the compiler knows the size to
use. Where it can't find the size (where the parameter is just a
pointer rather than a known array size) it still uses the old version.

Dave
Mar 4 '07 #2
Hi, Mark,
Sorry for delaying this response, since I am consulting the product team on
this issue. The process may need a long time and I appreciate your patience.

You are right. Per my test, such code:
#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT 1
...
char szBuf[10];
strcpy(szBuf, "test");

could not work fine as described in the article:
Secure Template Overloads
http://msdn2.microsoft.com/en-us/lib...8VS.80%29.aspx

The old version function will also be invoked.

Could you please mail me a response so that I can timely update you when I
get a response from the product team?
My email address is changliw_at_microsoft_dot_com.

If you have any other questions or concerns, please feel free to let me
know.
Have a good day!

Charles Wang
Microsoft Online Community Support
================================================== ===
Get notification to my posts through email? Please refer to:
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications

If you are using Outlook Express, please make sure you clear the check box
"Tools/Options/Read: Get 300 headers at a time" to see your reply promptly.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
================================================== ====
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
================================================== ====
This posting is provided "AS IS" with no warranties, and confers no rights.
================================================== ====

Mar 7 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: David Opstad | last post by:
I have a question about text rendering I'm hoping someone here can answer. Is there a way of doing linguistically correct rendering of Unicode strings in Python? In simple cases like Latin or...
0
by: Sarah Tegtmeier | last post by:
Hi I have a question about the correct use of the attribute xsi:schemaLocation. My programm has to process XML files where the value of this attribute causes some problems. The programm is...
1
by: Richard Golebiowski | last post by:
I have been trying to figure this out for quite some time and cannot find any examples in VB.Net or in VB that work correctly. I am working on an application where I want the user to be able to...
6
by: Rob Thorpe | last post by:
Given the code:- r = sscanf (s, "%lf", x); What is the correct output if the string s is simply "-" ? If "-" is considered the beginning of a number, that has been cut-short then the...
5
by: blackg | last post by:
Input string not in correct format -------------------------------------------------------------------------------- I am trying to view a picture from a table. I am getting this error Input string...
2
by: thisis | last post by:
Hi All, I need the PUBS.mdb for pulling images: PUBS.mdb must have the table: pub_info tbl_pub_info : has 3 fields Data_Type : ok Data_Type : ok
1
by: Mark Findlay | last post by:
I am using the #define for _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES in my Windows MFC App, (Visual Studio 2005) and yet continue to receive compiler warnings about various CRT functions. It was...
0
by: sehguh | last post by:
Hiya Folks, I am Currently using windows xp. Also using Visual Web Developer 2005 and Microsoft Sql server 2005. The main page consists of an aspx page and a master page. The page also...
3
lee123
by: lee123 | last post by:
I have a problem getting the correct to count +1 every time I get an answer right and the incorrect is the same. I have two lbl's named number1 and number2 which produces a Rnd# in each lbl. ...
10
by: onetruelove | last post by:
I want to creat a post like this blog: http://onlinetoefltest.blogspot.com/2007/08/level-c-lesson-1.html When you chose all the answers and click show answer a msg box will appear and tells how...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.