473,597 Members | 2,813 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Correct use of _CRT_SECURE_CPP _OVERLOAD_STAND ARD_NAMES?

I am using the #define for _CRT_SECURE_CPP _OVERLOAD_STAND ARD_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_STAND ARD_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_STAND ARD_NAMES
#undef _CRT_SECURE_CPP _OVERLOAD_STAND ARD_NAMES_COUNT
#define _CRT_SECURE_CPP _OVERLOAD_STAND ARD_NAMES 1
#define _CRT_SECURE_CPP _OVERLOAD_STAND ARD_NAMES_COUNT 1
//----------------------------------------

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

m_util.OutputDe bugString(_T("_ CRT_SECURE_CPP_ OVERLOAD_STANDA RD_NAMES=%d"),_ CRT_SECURE_CPP_ OVERLOAD_STANDA RD_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 5181
>I am using the #define for _CRT_SECURE_CPP _OVERLOAD_STAND ARD_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_CP P_OVERLOAD_STAN DARD_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_STAND ARD_NAMES 1
#define _CRT_SECURE_CPP _OVERLOAD_STAND ARD_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_mic rosoft_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
3012
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 Japanese I can just print the string and see the correct results. However, I don't know how to get Python to do the right thing for writing systems which require contextual processing. For example, let's say I create this Unicode string in Arabic: ...
0
10716
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 written in C++ using Xerces C++ version 2.3.0. An older older version of the programm used Xerces C++ version 1.6.0. The XML files look like the following example:
1
7752
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 select a peinter and printer tray to print reports out. In Crystal Reports 8.5, I can select a printer and tray and it prints correctly. I did a test report that I use to tell me the value that Crystal Reports is using for the paper source. When I...
6
3479
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 correct output is that r = EOF. If it is taken to be a letter in the stream, then the output should be r = 0, as far as I can see. My compiler gives EOF.
5
2505
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 not in the correct format. Input string was not in a correct format. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it...
2
4975
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
419
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 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...
0
3160
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 consists of a label control(hidden when run in browser). Also an Sql data source control connected to database tables for a photo album. Also label web control ID=UserIdValue. Also a Details View control ID=dvPictureInsert Problem is how to work out...
3
1727
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. I have a txt box for the answer called useranswer. A button to check if the answer is right called btnanswer. I have just added two more lbl's for the correct named lblcorrect & the other is lblincorrect. How do I get this to count when the...
10
2195
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 many answers are correct I view the blog source and copied all the code to my post but it didn't work when i click the show answer button in my post. Can any one help me with the code? Thanks in advance
0
7981
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
8392
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8262
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5437
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3894
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2410
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1500
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1245
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.