Click here to Skip to main content
15,910,872 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to inverse a variable in bit level? Pin
toxcct10-Jan-09 22:57
toxcct10-Jan-09 22:57 
AnswerRe: A plain approach Pin
CPallini8-Jan-09 22:44
mveCPallini8-Jan-09 22:44 
GeneralRe: A plain approach Pin
Iain Clarke, Warrior Programmer9-Jan-09 0:16
Iain Clarke, Warrior Programmer9-Jan-09 0:16 
JokeRe: A plain approach Pin
CPallini9-Jan-09 0:28
mveCPallini9-Jan-09 0:28 
GeneralRe: A plain approach Pin
Randor 9-Jan-09 1:05
professional Randor 9-Jan-09 1:05 
GeneralRe: A plain approach Pin
CPallini9-Jan-09 1:43
mveCPallini9-Jan-09 1:43 
GeneralRe: How to inverse a variable in bit level? Pin
Luc Pattyn9-Jan-09 2:51
sitebuilderLuc Pattyn9-Jan-09 2:51 
QuestionPotential problem with 'typedef redefinition' Pin
6Qing888-Jan-09 20:27
6Qing888-Jan-09 20:27 
hi, everyone
recently I started a new project which needs to be written in plain C,
and I got problem with different compilers that:

I want the declaration of public APIs along with data types required to
be in some separate files, and the definition of the types in some others,
for example:

interface.h
struct _VECTOR;
/**
* there's a problem with the absence of 'struct' in function
* declaration at least in mingw2.95, but that's not the point
* of my post.
*/
void _InitVector(struct _VECTOR* pVector);

implementation.h
#include "interface.h"

/* my point is here */
typedef struct _tagVECTOR {
int a;
} _VECTOR, *_PVECTOR;

implementation.c
#include "implementation.h"

void _InitVector(struct _VECTOR* pVector)
{
pVector->a = 1; /* derefferencing pointer to imcomplete type. */
}

It seems that the compiler cannot recognize the fact that _VECTOR is a typedef
name of the struct _tagVECTOR;

By the definition of 'typedef', I know that _VECTOR declared in "interface.h"
is exactly the same entity to that in "implementation.h", although it turned
out to be a typedef name of _tagVECTOR, but it won't compile in mingw2.95 with
the error mentioned in the code above.

Revised version can solve the problem:
typedef struct _VECTOR {
int a;
} *_PVECTOR;

But I want it to be consistent with the general idea, so I revised further:
typedef struct _VECTOR {
int a;
} _VECTOR, *_PVECTOR;

It compiled with no problem, but I'm not sure if I'm lucky enough with other
compilers holding the potential issue of "typedef redefinition".

Thanks in advance.


Smile | :)
AnswerRe: Potential problem with 'typedef redefinition' Pin
sashoalm8-Jan-09 20:32
sashoalm8-Jan-09 20:32 
GeneralRe: Potential problem with 'typedef redefinition' Pin
6Qing888-Jan-09 20:40
6Qing888-Jan-09 20:40 
GeneralRe: Potential problem with 'typedef redefinition' Pin
sashoalm8-Jan-09 21:37
sashoalm8-Jan-09 21:37 
AnswerRe: Potential problem with 'typedef redefinition' Pin
Stuart Dootson8-Jan-09 21:45
professionalStuart Dootson8-Jan-09 21:45 
QuestionFont and size of default message Box Pin
tasumisra8-Jan-09 20:04
tasumisra8-Jan-09 20:04 
AnswerRe: Font and size of default message Box Pin
Randor 8-Jan-09 20:34
professional Randor 8-Jan-09 20:34 
QuestionLoad data in Combobox in VC++6.0 Pin
aa_zz8-Jan-09 19:12
aa_zz8-Jan-09 19:12 
AnswerRe: Load data in Combobox in VC++6.0 Pin
Hamid_RT8-Jan-09 19:20
Hamid_RT8-Jan-09 19:20 
GeneralRe: Load data in Combobox in VC++6.0 Pin
aa_zz8-Jan-09 19:24
aa_zz8-Jan-09 19:24 
GeneralRe: Load data in Combobox in VC++6.0 Pin
Hamid_RT8-Jan-09 19:31
Hamid_RT8-Jan-09 19:31 
AnswerRe: Load data in Combobox in VC++6.0 Pin
Chandrasekharan P8-Jan-09 19:25
Chandrasekharan P8-Jan-09 19:25 
GeneralRe: Load data in Combobox in VC++6.0 Pin
aa_zz8-Jan-09 19:38
aa_zz8-Jan-09 19:38 
AnswerRe: Load data in Combobox in VC++6.0 Pin
David Crow9-Jan-09 3:31
David Crow9-Jan-09 3:31 
QuestionInvoking a Web Service using managed C++ OR VC++ .NET Pin
Thomas_Mathews8-Jan-09 18:31
Thomas_Mathews8-Jan-09 18:31 
AnswerRe: Invoking a Web Service using managed C++ OR VC++ .NET Pin
Malli_S8-Jan-09 18:55
Malli_S8-Jan-09 18:55 
AnswerRe: Invoking a Web Service using managed C++ OR VC++ .NET Pin
Hamid_RT8-Jan-09 19:28
Hamid_RT8-Jan-09 19:28 
Questionsocket and ethernet Pin
pramod_r8-Jan-09 18:10
pramod_r8-Jan-09 18:10 

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.