Click here to Skip to main content
15,888,527 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Application crashes only in release mode (possible heap/stack corruption) Pin
XTAL2569-Dec-10 13:11
XTAL2569-Dec-10 13:11 
GeneralRe: Application crashes only in release mode (possible heap/stack corruption) Pin
Luc Pattyn9-Dec-10 13:16
sitebuilderLuc Pattyn9-Dec-10 13:16 
GeneralRe: Application crashes only in release mode (possible heap/stack corruption) Pin
XTAL2569-Dec-10 17:48
XTAL2569-Dec-10 17:48 
GeneralRe: Application crashes only in release mode (possible heap/stack corruption) Pin
Luc Pattyn9-Dec-10 22:47
sitebuilderLuc Pattyn9-Dec-10 22:47 
GeneralRe: Application crashes only in release mode (possible heap/stack corruption) Pin
XTAL2569-Dec-10 23:21
XTAL2569-Dec-10 23:21 
AnswerRe: Application crashes only in release mode (possible heap/stack corruption) Pin
Rajesh R Subramanian9-Dec-10 17:26
professionalRajesh R Subramanian9-Dec-10 17:26 
AnswerRe: Application crashes only in release mode (possible heap/stack corruption) Pin
XTAL25612-Dec-10 12:09
XTAL25612-Dec-10 12:09 
QuestionC Casting Problem Pin
Andy2029-Dec-10 8:14
Andy2029-Dec-10 8:14 
I have seen the term Fixed_32 for a data item with MSB = 1 and LSB = 1/2**31 ;
Max = 1.0 and Min = -1.0 with units of semicircles (used for Latitude and Longitude)

I did think this was a float to the IEEE-754 Floating-Point Representation.
However the 3rd party that is reading some data via a message structure cannot see the same value.
I mistaken the term Fixed_32 as a standard float but it is a 32 bit int in the message.

The scalling is:-

#define	BEARING_SCALING          	4.65661287307739E-10 

typedef struct ReceiveMessage
{
    unsigned int msgNumber;      // Msg number
    int             msgPosLat;      // Msg latitude
    int             msgPosLong;     // Msg longitude
    unsigned int msgQuality;     // Msg quality
}positionData

#define	BEARING_SCALING          	4.65661287307739E-10 
However I get a crash when I try to load the value (the Latitude was declared as a double and I tried to cast to the int and vice versa.

Code:

// Note 180 is used to scale up from semicircles to degrees
double lat = 55.55;
positionData.msgPosLat = (int)(lat/(BEARING_SCALING * 180));

// and the other way for reading:-

 lat = (double)( positionData.msgPosLat) * BEARING_SCALING * 180;


What is going wrong please, is it the oder of casting or do I need to use fix point stuff?
AnswerRe: C Casting Problem Pin
Luc Pattyn9-Dec-10 9:01
sitebuilderLuc Pattyn9-Dec-10 9:01 
GeneralRe: C Casting Problem Pin
Andy2029-Dec-10 10:41
Andy2029-Dec-10 10:41 
GeneralRe: C Casting Problem [modified] Pin
Luc Pattyn9-Dec-10 11:06
sitebuilderLuc Pattyn9-Dec-10 11:06 
AnswerRe: C Casting Problem Pin
mbue9-Dec-10 12:07
mbue9-Dec-10 12:07 
QuestionSave image from picturebox use MFC Pin
josipahutar9-Dec-10 8:02
josipahutar9-Dec-10 8:02 
AnswerRe: Save image from picturebox use MFC Pin
mbue9-Dec-10 12:16
mbue9-Dec-10 12:16 
GeneralRe: Save image from picturebox use MFC Pin
tagopi9-Dec-10 17:08
tagopi9-Dec-10 17:08 
GeneralRe: Save image from picturebox use MFC Pin
josipahutar11-Dec-10 7:27
josipahutar11-Dec-10 7:27 
GeneralRe: Save image from picturebox use MFC Pin
josipahutar11-Dec-10 7:38
josipahutar11-Dec-10 7:38 
GeneralRe: Save image from picturebox use MFC Pin
tagopi12-Dec-10 17:08
tagopi12-Dec-10 17:08 
GeneralRe: Save image from picturebox use MFC Pin
josipahutar13-Dec-10 7:29
josipahutar13-Dec-10 7:29 
GeneralRe: Save image from picturebox use MFC Pin
tagopi16-Dec-10 16:45
tagopi16-Dec-10 16:45 
Question890918 - keystroke seems not to generate the desired command Pin
ilostmyid29-Dec-10 6:45
professionalilostmyid29-Dec-10 6:45 
AnswerRe: 890918 - keystroke seems not to generate the desired command Pin
mbue9-Dec-10 12:25
mbue9-Dec-10 12:25 
GeneralRe: 890918 - keystroke seems not to generate the desired command Pin
ilostmyid210-Dec-10 3:53
professionalilostmyid210-Dec-10 3:53 
GeneralRe: 890918 - keystroke seems not to generate the desired command Pin
mbue10-Dec-10 8:59
mbue10-Dec-10 8:59 
GeneralRe: 890918 - keystroke seems not to generate the desired command Pin
ilostmyid219-Dec-10 0:38
professionalilostmyid219-Dec-10 0:38 

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.