Click here to Skip to main content
15,878,852 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: float vs double - tricky performance issue Pin
harold aptroot30-Sep-09 11:15
harold aptroot30-Sep-09 11:15 
GeneralRe: float vs double - tricky performance issue Pin
Chris Losinger30-Sep-09 11:19
professionalChris Losinger30-Sep-09 11:19 
AnswerRe: float vs double - tricky performance issue Pin
TimothyPMoore30-Sep-09 11:56
TimothyPMoore30-Sep-09 11:56 
GeneralRe: float vs double - tricky performance issue [modified] Pin
Chris Losinger30-Sep-09 12:01
professionalChris Losinger30-Sep-09 12:01 
GeneralRe: float vs double - tricky performance issue Pin
TimothyPMoore30-Sep-09 13:02
TimothyPMoore30-Sep-09 13:02 
GeneralRe: float vs double - tricky performance issue Pin
Rick York30-Sep-09 13:29
mveRick York30-Sep-09 13:29 
GeneralRe: float vs double - tricky performance issue Pin
Chris Losinger30-Sep-09 13:38
professionalChris Losinger30-Sep-09 13:38 
QuestionEnumerated Type Not Comparing Correctly Pin
Jim Fell30-Sep-09 8:49
Jim Fell30-Sep-09 8:49 
Hello. I'm writing some C code for an embedded application, and I've run into a problem wherein a compare against an enumerated value is not being executed correctly. Take the following code snippet, for example:

typedef unsigned int UINT16;
typedef enum enum_items_tag
{
   ITEM_1,
   ITEM_2,
   ITEM_3,

   /* ... */

   ITEM_918,
   MAX_ENUM_ITEMS
} enum_items_t;

UINT16 n;

for ( n = 0; n < MAX_ENUM_ITEMS; n++ )
{
   // Do something
}


The code executes as expected, until n is incremented to equal MAX_ENUM_ITEMS, at which time the compare fails, and execution continues within the loop (when it should have exited). I've done things like this in the past without any problems.

I've tried re-typing n as enum_items_t (i.e. declaring n as "enum_items_t n"), as well as type casting MAX_ENUM_ITEMS as UINT16. The only other thing I can think of at this point is that maybe there is an issue with the number of items there are in my enumerated type (919). Does anyone know if there are such constraints on enumerated types? I'm using a GCC based compiler. Or, if you have any other ideas, it would be much appreciated. Thanks.
AnswerRe: Enumerated Type Not Comparing Correctly Pin
includeh1030-Sep-09 8:56
includeh1030-Sep-09 8:56 
GeneralRe: Enumerated Type Not Comparing Correctly Pin
Jim Fell30-Sep-09 9:02
Jim Fell30-Sep-09 9:02 
QuestionRe: Enumerated Type Not Comparing Correctly Pin
CPallini30-Sep-09 9:23
mveCPallini30-Sep-09 9:23 
AnswerRe: Enumerated Type Not Comparing Correctly Pin
Jim Fell30-Sep-09 9:58
Jim Fell30-Sep-09 9:58 
GeneralRe: Enumerated Type Not Comparing Correctly Pin
CPallini30-Sep-09 10:57
mveCPallini30-Sep-09 10:57 
AnswerRe: Enumerated Type Not Comparing Correctly Pin
Jim Fell30-Sep-09 9:59
Jim Fell30-Sep-09 9:59 
QuestionIs exe file aligned in size? Pin
includeh1030-Sep-09 5:09
includeh1030-Sep-09 5:09 
AnswerRe: Is exe file aligned in size? Pin
Joe Woodbury30-Sep-09 6:01
professionalJoe Woodbury30-Sep-09 6:01 
GeneralRe: Is exe file aligned in size? Pin
includeh1030-Sep-09 8:46
includeh1030-Sep-09 8:46 
GeneralRe: Is exe file aligned in size? Pin
Joe Woodbury30-Sep-09 8:52
professionalJoe Woodbury30-Sep-09 8:52 
GeneralRe: Is exe file aligned in size? Pin
includeh1030-Sep-09 9:37
includeh1030-Sep-09 9:37 
AnswerRe: Is exe file aligned in size? Pin
krmed30-Sep-09 6:02
krmed30-Sep-09 6:02 
GeneralRe: Is exe file aligned in size? Pin
Richard MacCutchan30-Sep-09 6:17
mveRichard MacCutchan30-Sep-09 6:17 
AnswerRe: Is exe file aligned in size? Pin
David Crow30-Sep-09 9:51
David Crow30-Sep-09 9:51 
GeneralRe: Is exe file aligned in size? Pin
krmed1-Oct-09 0:25
krmed1-Oct-09 0:25 
GeneralRe: Is exe file aligned in size? Pin
David Crow1-Oct-09 2:16
David Crow1-Oct-09 2:16 
QuestionComboBox speed issue with XP style Pin
user94130-Sep-09 4:49
user94130-Sep-09 4:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.