473,395 Members | 1,790 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,395 software developers and data experts.

Strange behavior with header file macro

I am having VERY weird behavior with a variable in my header file. Basically I have one .c file and one .h file where I store all definitions and prototypes. I have a "#define INFINITY 15000" macro in there which worked fine in my program until out of the blue it just decided not to work. Doing "int x = INFINITY" would yield garbage values instead.

Very puzzled, I thought maybe the compiler wasn't detecting changes in my .h file or something so I added dummy macros in there just to change it. Didn't work. Then, I changed "INFINITY" to INF in both my files and it worked! Yet STILL, when I changed back to "INFINITY" right after that, the problems came back.

Any ideas? I am on Windows using MinGW. compilation steps are just "gcc filename.c" with no options set.
Dec 7 '08 #1
2 1447
weaknessforcats
9,208 Expert Mod 8TB
I did a brief Google of INFINITY+Mingw and I found enough to tell me that INFINITY is a bad choice. Like it appears to be already used .
Dec 7 '08 #2
Yup its already used in the math.h library. Problem solved. Thanks for youre help.
Dec 7 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Carl Youngblood | last post by:
I recognize that I may not be giving sufficient information with this, but in the interest of not bogging the list down with too much code, I'll try and post just a little information and then if...
18
by: Exits Funnel | last post by:
Hello, I'm a little confused about where I should include header files and was wondering whether there was some convention. Imagine I've written a class foo and put the definition in foo.h and...
4
by: Brock | last post by:
Hello all: I apologize if this query seems a bit off-topic. But I couldn't think of another place to post my message. I would like to get an idea of how you all like to handle preprocessor...
3
by: bill | last post by:
I firmly believe that it is always a bad idea to put code in a header file. Nothing pisses me off more than seeing function definitions in a ..h, and I recently was truly blessed :) to witness...
1
by: Shrishail Rana | last post by:
Hello all, Here's another mind puzzle from me :-) Today I tried to add a new resource to my program and VS.NET (v 7.0.9466) just died. What I mean by that is that it silently and quickly...
1
by: Alexander Inochkin | last post by:
Hi! I found same strange behavior of ASP.NET. It is possible this is the bug. Follow the steps:
5
by: cmiddlebrook | last post by:
Greetings all, I have a class which contains a function with the following signature: MC_SDLImage* LoadImage(const std::string& file, int id); and I call this function in two places in my...
2
by: Antonio | last post by:
Good morning, everyone. Here is the strange behavior: I have a datagrid (dgPIs) with paging enabled. When I click to view any page in the grid, it runs the private void lnkIPReg method,...
0
by: mmcd79 | last post by:
I'm wondering if anyone else is having this issue. It's driving me batty. It seems my mouse wants to "double click" on items when I'm just doing a single click. I thought it was the mouse so I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
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
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...
0
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...

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.