How to forward typedef’d struct in .h

Move the typedef struct Preprocessor Prepro; to the header the file and the definition in the c file along with the Prepro_init definition. This is will forward declare it for you with no issues. Preprocessor.h #ifndef _PREPROCESSOR_H_ #define _PREPROCESSOR_H_ #define MAX_FILES 15 typedef struct Preprocessor Prepro; void Prepro_init(Prepro* p); #endif Preprocessor.c #include “Preprocessor.h” #include <stdio.h> … Read more

Why do type alias templates use ‘using’ instead of ‘typedef’ in their syntax?

Here is what Bjarne Stroustrup says about why they introduced using instead of extending typedef: The keyword using is used to get a linear notation “name followed by what it refers to.” We tried with the conventional and convoluted typedef solution, but never managed to get a complete and coherent solution until we settled on … Read more

C++ ‘typedef’ vs. ‘using … = …’ [duplicate]

They are the same. To quote the C++11 standard (or the draft to be specific): A typedef-name can also be introduced by an alias-declaration. The identifier following the using keyword becomes a typedef-name and the optional attribute-specifier-seq following the identifier appertains to that typedef-name. It has the same semantics as if it were introduced by … Read more

typedef pointer const weirdness

Note that typedef int* intptr; const intptr x; is not the same as: const int* x; intptr is pointer to int. const intptr is constant pointer to int, not pointer to constant int. so, after a typedef pointer, i can’t make it const to the content anymore? There are some ugly ways, such as gcc’s … Read more

typedef a struct before it’s declared

This is completely fine. The first use of struct tag like yours is a forward declaration of the struct type. Beware though that your usage of _Foo is not conforming. Identifiers with leading underscore and following capital letter are reserved. Don’t do that. Trailing underscore would be ok.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)