preprocessor uint to unsigned int

Reply

Join Date: Aug 2008
Posts: 149
Reputation: monkey_king is on a distinguished road 
Solved Threads: 8
monkey_king monkey_king is offline Offline
Junior Poster

preprocessor uint to unsigned int

 
0
  #1
Nov 23rd, 2008
I've made a program using gcc as a compiler.

In my loops I've been using a uint type as the type of my loop variable.

But now it seems that some systems doesn't support this type.

Can I make a preprocessor conditional that does a

#define uint to unsigned int

if typename uint doesn't exist

thanks in advance
Last edited by monkey_king; Nov 23rd, 2008 at 8:56 pm. Reason: add more info
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 944
Reputation: MosaicFuneral is just really nice MosaicFuneral is just really nice MosaicFuneral is just really nice MosaicFuneral is just really nice MosaicFuneral is just really nice 
Solved Threads: 92
MosaicFuneral's Avatar
MosaicFuneral MosaicFuneral is online now Online
Posting Shark

Re: preprocessor uint to unsigned int

 
0
  #2
Nov 23rd, 2008
Don't use macros as types.

  1. typedef unsigned int uint;
"Jedenfalls bin ich überzeugt, daß der Alte nicht würfelt."
"I became very sensitive to what will happen to all this and all of us." -Two geniuses named Albert
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 3,114
Reputation: WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of WaltP has much to be proud of 
Solved Threads: 281
Moderator
WaltP's Avatar
WaltP WaltP is offline Offline
Posting Sensei

Re: preprocessor uint to unsigned int

 
0
  #3
Nov 24th, 2008
Originally Posted by monkey_king View Post
I've made a program using gcc as a compiler.

In my loops I've been using a uint type as the type of my loop variable.

But now it seems that some systems doesn't support this type.

Can I make a preprocessor conditional that does a

#define uint to unsigned int

if typename uint doesn't exist

thanks in advance
Why? Use the standard unsigned int rather than a type that doesn't exist in most compilers. You've now seen the reason we try to always recommend not using compiler-specific enhancements.
The 3 Laws of the Procrastination Society:
1) Never do today that which can be put off until tomorrow
2) Tomorrow never comes
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC