473,289 Members | 2,108 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,289 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 1441
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.