Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How could I (temporarily) un-typedef something?

Tags:

c++

I'm using a 3rd party library that typedefs byte to char.

(This is evil as char could be signed or unsigned depending on the compiler's choice).

Unfortunately that typedef has spilled over into the codebase that I maintain and I'm keen to remove them: using uint8_t directly instead.

Is there a way I can somehow undo this typedef once I get to my code (i.e. direcly after #include <3rdpartylib>)?

I will be in a position to remove the "solution" from my codebase once I've removed all the bytes.

like image 767
P45 Imminent Avatar asked Sep 16 '14 11:09

P45 Imminent


People also ask

How do you use a typedef in C++?

The above codes are the basic syntax for using the typedef keywords in the programming logic. We can use the typedef as the structure using struct keyword type; by using this type, we can create n number of data types declaration as well as change the name in a single process. How does typedef work in C++?

Can a type name be hidden in a typedef?

In contrast, the type name can hide in a typedef for certain complex types, such as function, function-pointer, and array types. (And in C, typedef struct { /* lots of things */ } foo; .) It can be upgraded to a alias template without changing syntax significantly.

How to wrap typedefs in a class?

Second way is to typedef at each place-of-use, and make it only visible to that place-of-use (by putting it inside the class or method that uses it). (1) Put the typedef close to the type that is being wrapped.

What does “typedef void (*something)...)” mean in C?

What does “typedef void (*Something) ())” mean in C? Let’s ignore the unbalanced paranthesis ) at the end. void (*Something) () declares Something as type alias to pointer to function taking variadic arguments (0 to any number) and returning void


1 Answers

Its not possible to do this. Undef only works on macros.

like image 106
sp497 Avatar answered Oct 12 '22 09:10

sp497