I'm having troubles when calling a function taking a pointer to a string as a parameter. I need to get an Element's name.
// method
void getStringFromCsv( char ** str );
Let me introduce the structures I'm working with (not written by me and part of a much bigger project, I can't modify them).
// typedefs
typedef char T_CHAR64[...
typedef struct foo
{
bool my_bool;
int my_int;
} foo;
In the example above I understand that my_bool will be initialized randomly to either true or false but what about my_int? I assumed that my_int would be default initialized to 0 but that seems not to be the case.
Defining structs in this way appears to be incompatible wit...
I'm curious what the difference here is when typedefing an enum or struct. Is there any difference semantically between these two blocks?
This:
typedef enum { first, second, third } SomeEnum;
and this:
enum SomeEnum { first, second, third };
typedef enum SomeEnum SomeEnum;
Same deal for structs. I've seen both in use, and they b...
I'm writing a program in C++ that uses genetic techniques to optimize an expression tree.
I'm trying to write a class Tree which has as a data member Node root. The node constructor generates a random tree of nodes with +,-,*,/ as nodes and the integers as leaves.
I've been working on this awhile, and I'm not yet clear on the best str...
I am confused when should I add the trailing _t to typedef'ed types?
For example, should I do this:
typedef struct image image_t;
or this:
typedef struct image image;
What are the general rules?
Another example, should I do this:
typdef enum { ARRAY_CLOSED, ARRAY_OPEN, ARRAY_HALFOPEN } array_type_t;
or this:
typdef enum { ARR...
I have an enum defined as follows:
typedef enum modifiers {
modifierNone=-1,
modifierCmd,
modifierShift,
modifierOption
} Modifier;
What i would like to do is pass a string value from one method to another for exampl...
I want to write a wrap for a DLL file, in this case for python. The problem is that the argument types are not the C standard ones. They have been typedef'end to something else.
I have the header files for the DLL files... so I can manually track the original standard C type the argument type was typedef'ined to. But wanted a more syste...
Hi,
I need to generalise a C++ typedef so I do not need to copy and paste a lot of code. I am serializing blitz arrays using boost and I am defining my own load and save methods and need to do this based on template parameters. Basically I don't know how to generalize
typedef blitz::Array<double, 2> my_Matrix;
for higher order te...
Is there any benefit in having never-defined structures in C ?
Example in SQLite source code :
/* struct sqlite3_stmt is never defined */
typedef struct sqlite3_stmt sqlite3_stmt;
And the object is manipulated like so :
typedef struct Vdbe Vdbe;
struct Vdbe {
/* lots of members */
};
int sqlite3_step(sqlite3_stmt *pStmt) {
...
I have an enum in a namespace and I'd like to use it as if it were in a different namespace. Intuitively, I figured I could use 'using' or 'typedef' to accomplish this, but neither actually work. Code snippet to prove it, tested on GCC and Sun CC:
namespace foo
{
enum bar {
A
};
}
namespace buzz
{
// Which of these two methods I ...
To save some space in my code, I made this typedef:
typedef clients.members.at(selectedTab) currentMember;
however, g++ gives me this error:
error: expected initializer before '.' token
I figure that I'm misusing typedef, since clients.members.at(selectedTab) is a function call and not a type. Is there a way to do what I'm trying ...
Hi,
I am having some trouble figuring out the syntax for typedef reinterpret_cast.
Can anyone help?
EDIT
What I am trying to do. I am always hesitant as people seem to get caught up in every thing else except what the problem actually is as you can see with my last post which lead to a whole bunch of nothing.
I am trying to come up w...
Can anybody explain the difference between
#define int* char
and
typedef int* char;
...
Both this style:
struct _something
{
...
};
typedef struct _something someting;
and that style:
typedef struct _something
{
...
} something;
are correct typedef declarations in C.
Note that the presence of the structure declaration in the header file is made on purpose: I need to have access to the inner components of the stru...
Hello there
I am facing a weird problem I have defined I a structure in a C header file:
typedef struct iRecActive{
char iRecSID[32];
unsigned char RecStatus;
int curSel;
}iRecAcitve_t;
but when I use the same structure in another file, the compiler doesn't recognize the structure even though I have double checked that...
Possible Duplicate:
typedef stuct problem in C
Hello there
I am facing I have defined I a structure in a C header file:
typedef struct iRecActive{
char iRecSID[32];
unsigned char RecStatus;
int curSel;
}iRecAcitve_t;
but when I use the same structure in another file, the compiler gives some error:
error C227...
So, it's been 5 or 6 years since I've used C++ for a large project, and about half a year since I last had to deal with small/trivial C++ programs and the C++ runtime in general. I've decided I want to re-learn the language, primarily because it might prove very relevant for an upcoming project at work.
I've been working mainly with C ...
I have an Objective-C protocol:
typedef enum {
ViewStateNone
} ViewState;
@protocol ViewStateable
- (void)initViewState:(ViewState)viewState;
- (void)setViewState:(ViewState)viewState;
@end
I'm using this protocol in the following class:
#import "ViewStateable.h"
typedef enum {
ViewStateNone,
ViewStateSummary,
Vie...
Consider this code:
typedef int type1;
typedef int type2;
template <typename>
struct some_trait;
template <>
struct some_trait<type1>
{
static const int something=1;
};
template <>
struct some_trait<type2>
{
static const int something=2;
};
It fails because what the compiler sees is two specializations of some_trait<int>.
...
Is there a free tool (some kind of a static checker) that does typedef-based type-checking for a plain C (not C++) and runs on Linux (or any kind of free Unix)? I am aware of a commercial one: PC-lint/FlexeLint. It does exactly what I want, but it's not free and Windows-only. Here is an example from it's manual:
typedef int Count;
typed...