Click here to Skip to main content
16,006,001 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: A very basic question about ODBC Pin
David Crow4-Apr-08 6:04
David Crow4-Apr-08 6:04 
GeneralRe: A very basic question about ODBC Pin
Mark Salsbery4-Apr-08 7:18
Mark Salsbery4-Apr-08 7:18 
GeneralChump Is Stumped By VARIANT Problem Pin
Eurosid4-Apr-08 4:34
Eurosid4-Apr-08 4:34 
GeneralRe: Chump Is Stumped By VARIANT Problem Pin
led mike4-Apr-08 5:04
led mike4-Apr-08 5:04 
GeneralRe: Chump Is Stumped By VARIANT Problem Pin
Eurosid4-Apr-08 5:21
Eurosid4-Apr-08 5:21 
GeneralRe: Chump Is Stumped By VARIANT Problem Pin
led mike4-Apr-08 5:32
led mike4-Apr-08 5:32 
GeneralRe: Chump Is Stumped By VARIANT Problem Pin
Eurosid4-Apr-08 5:49
Eurosid4-Apr-08 5:49 
GeneralRe: Chump Is Stumped By VARIANT Problem Pin
Iain Clarke, Warrior Programmer4-Apr-08 5:43
Iain Clarke, Warrior Programmer4-Apr-08 5:43 
I'm slightly curious what you mean by "fails". Do you put the variant in a watch window, and see wrong numbers? From your later post, I think you think that V_R4 is a function which passes success / failure.

Looking in OLEAUTO.H,
#define V_UNION(X, Y)   ((X)->Y)
#define V_VT(X)         ((X)->vt)
#define V_R4(X)          V_UNION(X, fltVal)


So...
VARIANT var;
VariantInit (&var);
V_VT(&var) = VT_R4;
V_R4(&var) = 0.0;

becomes
V_UNION(&var,ftlVal) = 0.0;

becomes
(&var)->ftlVal = 0.0;


which looks fine to me.

BUT:

You are using this in an if statement.

Imagine the following:
if (1)
{
   //  pretty guaranteed to get here
} else {
   // not likely...
}

and
if (a=0)
{
   //  pretty unlikely to get here
} else {
   // 
}


The second if evaluates to 0, which will fail the if.

Cutting to the chase:
V_R4(&blah) = a number

evaluates to whatever the number is - and 0 is FALSE.


Here endeth the lesson.

Iain.

Iain Clarke appears because CPallini still cares.

GeneralRe: Chump Is Stumped By VARIANT Problem Pin
Eurosid4-Apr-08 5:51
Eurosid4-Apr-08 5:51 
Generalprimary key Pin
Try4-Apr-08 4:34
Try4-Apr-08 4:34 
GeneralRe: primary key Pin
Nitheesh George4-Apr-08 4:45
Nitheesh George4-Apr-08 4:45 
QuestionRe: primary key Pin
David Crow4-Apr-08 6:08
David Crow4-Apr-08 6:08 
GeneralRe: primary key Pin
Try6-Apr-08 1:29
Try6-Apr-08 1:29 
GeneralRe: primary key Pin
Mark Salsbery4-Apr-08 7:26
Mark Salsbery4-Apr-08 7:26 
GeneralA strange problem with CRecordset derived class Pin
Joseph Marzbani4-Apr-08 3:27
Joseph Marzbani4-Apr-08 3:27 
GeneralRe: A strange problem with CRecordset derived class Pin
prasad_som4-Apr-08 3:37
prasad_som4-Apr-08 3:37 
GeneralRe: A strange problem with CRecordset derived class Pin
Cedric Moonen4-Apr-08 3:41
Cedric Moonen4-Apr-08 3:41 
GeneralRe: A strange problem with CRecordset derived class Pin
Joseph Marzbani4-Apr-08 3:56
Joseph Marzbani4-Apr-08 3:56 
GeneralRe: A strange problem with CRecordset derived class Pin
Cedric Moonen4-Apr-08 3:59
Cedric Moonen4-Apr-08 3:59 
GeneralRe: A strange problem with CRecordset derived class Pin
CPallini4-Apr-08 4:00
mveCPallini4-Apr-08 4:00 
GeneralRe: A strange problem with CRecordset derived class Pin
CPallini4-Apr-08 3:51
mveCPallini4-Apr-08 3:51 
GeneralRe: A strange problem with CRecordset derived class Pin
Joseph Marzbani4-Apr-08 3:58
Joseph Marzbani4-Apr-08 3:58 
QuestionRe: A strange problem with CRecordset derived class Pin
David Crow4-Apr-08 6:20
David Crow4-Apr-08 6:20 
GeneralRe: A strange problem with CRecordset derived class Pin
Joseph Marzbani4-Apr-08 8:51
Joseph Marzbani4-Apr-08 8:51 
QuestionHow to Split the main window of MDI applications? Pin
Ali Tavakol4-Apr-08 3:19
Ali Tavakol4-Apr-08 3:19 

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.