473,608 Members | 2,592 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MC++ basic

What does these codes mean as following?
#pragma push_macro("new ")
#undef new
Nov 17 '05 #1
5 2270
hangaround wrote:
What does these codes mean as following?
#pragma push_macro("new ")
#undef new


Try reading the documentation. It's online and installed with VC++.

http://msdn.microsoft.com/library/de...push_macro.asp
http://msdn.microsoft.com/library/de...fpop_macro.asp
http://msdn.microsoft.com/library/de..._directive.asp

-cd
Nov 17 '05 #2
Hi hangaround!
What does these codes mean as following?
#pragma push_macro("new ")
#undef new


See: push_macro
http://msdn.microsoft.com/library/en...Push_macro.asp

See: pop_macro
http://msdn.microsoft.com/library/en...fpop_macro.asp

See: undef
http://msdn.microsoft.com/library/en..._directive.asp

In short:
It saves the state of the macro "new" and then undefines this macro (so
it will use the C++ new-method).

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
Nov 17 '05 #3
Now see the code snippet in which that two statements stays
.......
#pragma push_macro("new ")
#undef new
CFileDialog dlg(TRUE);
dlg.m_pOFN->lpstrInitialDi r = m_strWorkingDir ;
dlg.m_pOFN->lpstrTitle = _T("Open an XMLSingle XML File");
dlg.m_pOFN->lpstrFilter = _T("XML Files (*.xml)\0*.xml\ 0");

if (IDOK == dlg.DoModal())
{
m_lbxAuthors.Re setContent();

XmlTextReader* xmlreader;
try
{
xmlreader = new XmlTextReader(d lg.GetPathName( ));
.......
since we undef the new , how can we use it in the
xmlreader = new XmlTextReader(d lg.GetPathName( ));

It confuses me.
Nov 17 '05 #4
hangaround wrote:
Now see the code snippet in which that two statements stays
......
#pragma push_macro("new ")
#undef new
CFileDialog dlg(TRUE);
dlg.m_pOFN->lpstrInitialDi r = m_strWorkingDir ;
dlg.m_pOFN->lpstrTitle = _T("Open an XMLSingle XML File");
dlg.m_pOFN->lpstrFilter = _T("XML Files (*.xml)\0*.xml\ 0");

if (IDOK == dlg.DoModal())
{
m_lbxAuthors.Re setContent();

XmlTextReader* xmlreader;
try
{
xmlreader = new XmlTextReader(d lg.GetPathName( ));
......
since we undef the new , how can we use it in the
xmlreader = new XmlTextReader(d lg.GetPathName( ));

It confuses me.


new is a built-in operator in C++, but some libraries (particularly MFC)
define a macro of the same name to "hijack" memory allocation and hook their
own memory tracking system in.

In this case, the #undef is simply to make sure that it's the built-in new
that's being used, not any macro by that name.

-cd
Nov 17 '05 #5
aha! I know, millions of thanks!
Nov 17 '05 #6

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

Similar topics

3
6956
by: pix | last post by:
Hello, I would like to start learning Visual Basic, and I was wondering if there are any recomendations to any ebooks, or actual books for that matter. I have my eye on this book by John Smiley, any comments/suggestions would be greatly appreciated.
2
4222
by: AK | last post by:
I don't want any part of the previous discussion on Visual Basic versus Visual Basic.Net. My query is about using Visual Basic for Applications; and whether it is better to use Visual Basic 6 or Visual Basic.Net as a springboard for studying VBA. I use Office 2000 and would like to use VBA as a tool to customize it. I have zero programming experience. I would like to read through and work on the examples of a beginners
1
3322
by: Rookie | last post by:
I have done a lot of programming some time ago using Fortran and various varieties of the Basic programming languages, Hewlett Packard Technical Basic, QBasic, Quick Basic. With each of these languages there were documents (books, etc) which categorized and explained all of the functions, statements, etc. and how to use them. The documents explained the logic of the statement or function and provided examples. Also most of the books...
7
9274
by: Michael Foord | last post by:
#!/usr/bin/python -u # 15-09-04 # v1.0.0 # auth_example.py # A simple script manually demonstrating basic authentication. # Copyright Michael Foord # Free to use, modify and relicense. # No warranty express or implied for the accuracy, fitness to purpose
9
2231
by: Malcolm | last post by:
After some days' hard work I am now the proud possessor of an ANSI C BASIC interpreter. The question is, how is it most useful? At the moment I have a function int basic(const char *script, FILE *in, FILE *out, FILE *err); It returns 0 on success or -1 on fail.
56
4076
by: Dave Vandervies | last post by:
I just fixed a bug that some of the correctness pedants around here may find useful as ammunition. The problem was that some code would, very occasionally, die with a segmentation violation error. (Not as infrequent as some bugs that have been discussed here in the past, but maybe once in an overnight run of the program when it was configured to aggressively exercise the section that the bug was in.) It was easy enough to trap the...
3
2526
by: sefe dery | last post by:
hi ng, i try to create a asp.net 1.0 website on windows server 2003(Servername: ServerX) with iis 6.0. PROBLEM: The user should login with his windows credentials in basic.aspx and automatically redirect to his own files. i have the following file-structure:
10
2653
by: trippeer | last post by:
I have the source code to an old BASIC program that a friend of mine would like to run online. I am a beginner at JS, but I think that it would be a good choice for the project. My background is in C/C++ and web development. Any suggestions that might get me off to a good start here? I can provide more information if needed, but I am not sure what would be helpful. The program is 550 lines in what appears to be BASIC and is a calendar...
97
5470
by: Master Programmer | last post by:
An friend insider told me that VB is to be killled off within 18 months. I guess this makes sence now that C# is here. I believe it and am actualy surprised they ever even included it in VS 2003 in the first place. Anyone else heard about this development? The Master
6
3138
by: Simon Walsh | last post by:
I'm an Electronics student in college and I'm currently working on a project. I was given a circuit diagram for my project, from which I had to design a printed circuit board to be sent off and manufactured. I got my printed circuit board back and populated it with components. On my circuit board, I have a chip holder for a Basic STAMP microcontroller. To those unfamiliar with it, the Basic STAMP is a microcontroller which has an onboard...
0
8057
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
8491
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8329
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
6813
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6010
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5475
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();...
1
2472
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
1580
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1327
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.