0

I found this in SDL 2.0 source code. The SDL_Texture is repeated twice. It seems that we are aliasing "struct SDL_Texture" as "SDL_Texture". How is this useful? Can someone elaborate?

/**
 * An efficient driver-specific representation of pixel data
 */
struct SDL_Texture;
typedef struct SDL_Texture SDL_Texture;
Vallerious
  • 570
  • 6
  • 13
  • 12
    It's useful in C, because in C you normally need `struct SDL_Texture` to use it in code (e.g. when declaring a variable) if you don't use the `typedef` trick. In C++ it's pointless to do that. – Yksisarvinen Dec 21 '22 at 19:36

0 Answers0