Hi,
I have picked this piece of code(slightly modified) from one of gimpel
software's lint page "bug of the month"
#include <stdio.h>
#define ON_THE_ROCKS
const char *ice()
{
#if defined(SHAKEN_ NOT_STIRRED)
return "shaken not stirred";
#elif defined(STIRRED _NOT_SHAKEN)
return "stirred not shaken";
#elif defined(ON_THE_ ROCKS)
return "on the rocks";
#else
return "";
#endif
}
int main()
{
int i;
printf( "Celebrate the New Year " );
printf( "with your drink %s.\n", ice() );
return 0;
}
The output after compiling with gcc(Dev C++) and execution was
"Celebrate the New Year with your drink ." and not "Celebrate the New
Year with your drink on the rocks" as I expected.
The Reference Manual Explanation given was
750 local macro 'Symbol' (Location) not referenced -- A 'local'
macro is one that is not defined in a header file. The macro
was
not referenced throughout the module in which it is defined.
I am unable to follow the explanation as I tried including the macro in
a header file but got the same result. Am I missing something ? Can
anyone please explain in detail. 2 6082
Linny <li*******@gmai l.comwrote:
I have picked this piece of code(slightly modified) from one of gimpel
software's lint page "bug of the month"
#include <stdio.h>
#define ON_THE_ROCKS
const char *ice()
{
#if defined(SHAKEN_ NOT_STIRRED)
return "shaken not stirred";
#elif defined(STIRRED _NOT_SHAKEN)
return "stirred not shaken";
#elif defined(ON_THE_ ROCKS)
return "on the rocks";
#else
return "";
#endif
}
int main()
{
int i;
printf( "Celebrate the New Year " );
printf( "with your drink %s.\n", ice() );
return 0;
}
The output after compiling with gcc(Dev C++) and execution was
"Celebrate the New Year with your drink ." and not "Celebrate the New
Year with your drink on the rocks" as I expected.
The Reference Manual Explanation given was
750 local macro 'Symbol' (Location) not referenced -- A 'local'
macro is one that is not defined in a header file. The macro
was
not referenced throughout the module in which it is defined.
I am unable to follow the explanation as I tried including the macro in
a header file but got the same result. Am I missing something ? Can
anyone please explain in detail.
All you're missing is that in the program from the website http://www.gimpel.com/html/bugs/bug750.htm
in 'ON_THE_ROCKS' the 'O' in 'ROCKS' is a character 'O' when the
macro is defined, but in the test there's the number '0' instead,
so also this test fails and the function returns the empty string.
You seem to have not used copy-and-pasted the program and removed
the bug when you typed it in.
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\______________ ____________ http://toerring.de
Jens Thoms Toerring wrote:
Linny <li*******@gmai l.comwrote:
I have picked this piece of code(slightly modified) from one of gimpel
software's lint page "bug of the month"
#include <stdio.h>
#define ON_THE_ROCKS
const char *ice()
{
#if defined(SHAKEN_ NOT_STIRRED)
return "shaken not stirred";
#elif defined(STIRRED _NOT_SHAKEN)
return "stirred not shaken";
#elif defined(ON_THE_ ROCKS)
return "on the rocks";
#else
return "";
#endif
}
int main()
{
int i;
printf( "Celebrate the New Year " );
printf( "with your drink %s.\n", ice() );
return 0;
}
The output after compiling with gcc(Dev C++) and execution was
"Celebrate the New Year with your drink ." and not "Celebrate the New
Year with your drink on the rocks" as I expected.
The Reference Manual Explanation given was
750 local macro 'Symbol' (Location) not referenced -- A 'local'
macro is one that is not defined in a header file. The macro
was
not referenced throughout the module in which it is defined.
I am unable to follow the explanation as I tried including the macro in
a header file but got the same result. Am I missing something ? Can
anyone please explain in detail.
All you're missing is that in the program from the website
http://www.gimpel.com/html/bugs/bug750.htm
in 'ON_THE_ROCKS' the 'O' in 'ROCKS' is a character 'O' when the
macro is defined, but in the test there's the number '0' instead,
so also this test fails and the function returns the empty string.
You seem to have not used copy-and-pasted the program and removed
the bug when you typed it in.
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\______________ ____________ http://toerring.de
Thanks a Lot Jens... you are right
I missed it completely..... What a waste of time !! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Justin Carter |
last post by:
Hi. I'm using VB6 and trying to read in a simple text file. I'm
using a statement similar to the following, which generally works
fine.
Input #Item, variable1, variable2, variable3, etc.
The problem is that one of the strings that is read in, variable2 in
the above example, is a square symbol, . An error is thrown, and I
can't find a way to work around it. (I'm stuck reading in that
symbol, i.e. I can't just change it in the text...
|
by: Mike:o |
last post by:
I need to validate XML documents (orders) against their schema before
processing. The PurchaseOrder schema that we use references 3 other schemas
using the <imports ...> element. Here is the relationship:
- PurchaseOrder.xsd
- Base.xsd
- Item.xsd
- Party.xsd
These schemas are all located at a public Internet location. The imports
elements within the PurchaseOrder schema look like this:
|
by: bob |
last post by:
Need help with c macro.
Have this call in my c program.
stub.c
SYMBOL(ALPHA) << no, dont want to change this to any other form.
SYMBOL(BETA)
Need a macro to expand each of above to this.
|
by: vsp15584 |
last post by:
Hii..i use the coding as below :-
import java.applet.applet;
import java.awt.*;
import com.sun.j3d.utils.applet.mainframe;
import com.sun.j3d.utils.universe.*;
import com.sun.j3d.utils.geometry.*;
import javax.media.j3d.*;
import javax.vecmath.*;
|
by: f rom |
last post by:
----- Forwarded Message ----
From: Josiah Carlson <jcarlson@uci.edu>
To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org
Sent: Monday, December 4, 2006 10:03:28 PM
Subject: Re: 1>make_buildinfo.obj : error LNK2019: unresolved external symbol __imp__RegQueryValueExA@24 referenced in function _make_buildinfo2
Ask on python-list@python.org .
- Josiah
| |
by: karinmorena |
last post by:
I'm having 4 errors, I'm very new at this and I would appreciate your input. The error I get is:
Week5MortgageGUI.java:151:cannot find symbol
symbol: method allInterest(double,double,double)
Location: class Week5MortgageGUI
Week5MortgageLogic allint = logic.allInterest(amount, term, rate);
Week5MortgageGUI.java:152:cannot find symbol
symbol: method allInterest(double,double,double)
Location: class Week5MortgageGUI
|
by: kp |
last post by:
Hi,
I am compiling on an AIX 5.1 box and my test machine is AIX 5.3.
I run the foll. steps for compiling my test binary "test"
/usr/vacpp/bin/xlC test.c -c -o test.o -I/home/jag/progs/include -I/
usr/lpp/application/include
/usr/vacpp/bin/xlC -o test -L/home/jag/progs/lib -L/usr/lib -L/usr/lpp/
application/lib -brtl -s test.o -lapplicationapi -liconv
|
by: Sindhu Rani |
last post by:
i hav created 3 classes in 3 different files. am gettin an error durin compilation. wat shud i do???
C:\s\source>javac -d ..\classes devtestdrive.java
devtestdrive.java:5: cannot resolve symbol
symbol : class device
location: class devtestdrive
device d1=new tv();
^
devtestdrive.java:5: cannot resolve symbol
symbol : class tv
|
by: hjazz |
last post by:
Hi all,
I'm new to VS, and I'm using Visual Studio .NET 2003.
I'm trying to write a program which uses pcap libraries. However, I keep getting the following errors:
error LNK2019: unresolved external symbol __imp__inet_ntoa@4 referenced in function _got_packet
error LNK2019: unresolved external symbol __imp__ntohs@4 referenced in function _got_packet
error LNK2019: unresolved external symbol _Search referenced in function _got_packet...
|
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...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
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...
|
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...
|
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...
|
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();...
|
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...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |