Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3432040
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T07:24:01+00:00 2026-05-18T07:24:01+00:00

What are the purpose of api specific typedefs such as GLsizei GLint GLvoid? I

  • 0

What are the purpose of api specific typedefs such as GLsizei GLint GLvoid?

I see this everywhere in c and c++ code. Basic types are often typdefed with the libraries prefix/suffix. What’s the reasoning behind this? Is this good practice? Should my programs be doing something similar themselves?

At first glance it seems to make the code a little bit less readable. You have to take an instant to translate GLint into int in your head, and that’s an easy example.

Something like UINT makes more since to me, at least this is shortening unsigned int into four lettters.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T07:24:01+00:00Added an answer on May 18, 2026 at 7:24 am

    It’s not about shortening the names, but about portability. Different platforms will need to typedef those things differently.

    In Std-C, long may be 32 or 64 bits, depending on your compiler/target, so it can’t be safely assumed to be a certain size. A library author will thus typedef his own type, guaranteeing a certain size, with the knowledge of the target platform.

    E.g.

    #ifdef _WIN32
    typedef __int64 INT64;  // long will not be 64 bit on Windows/VC.
    #elif __GNU_C__
    typedef long INT64;  // gcc typically uses 64 bit longs.
    #elif // ... other platforms ...
    ...
    #endif
    

    And if compilers change type properties in future versions, the types can be edited in one place.

    In the past you also had a typical case where int might be 16 or 32 bits in size, so you couldn’t simply use the raw int type in code where you needed a DWORD-sized argument.

    Hence why you have things like LPARAM and WPARAM.

    It’s also used as a form of abstraction. Which is why you see typedefs like

    typedef int Handle;
    

    Because while it’s an int now, the library author reserves the ability to change it later down the track to anything else, say a void *, or any other type they deem necessary.

    But the client code doesn’t need to know it’s an int specifically, since that’s just what it currently happens to be. All the client needs to know is to pass it along to functions accepting a Handle type.

    Typedefs also allow configuration at compile time. E.g. some libraries may have a Real type for real numbers. It could be defined in a way such as

    #ifdef USE_DOUBLE_PREC
    typedef double Real;
    #else
    typedef float Real;
    #endif
    

    And the user of the library can optionally set /DUSE_DOUBLE_PREC when compiling to get double precision float support, but the important thing is that no library code needs to change for this to work, since it’s been abstracted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The purpose of this code is to pull upgrade.zip from a central server, extract
Working on an API but I've run into a problem. This specific part of
Is there a Web API equivalent to the MVC ActionMethodSelectorAttribute ? My specific purpose
I have been working on Google AdWords and came across this code adwords-api-6.4.0, com.google.api.adwords.lib.AdWordsUser
I'm looking for a general purpose API/web service/tool/etc... that allows convert a given HTML
[purpose] This simple command sequence runs expected in the Windows' CMD shell: dir &
The purpose is to have a USB flash to have a developer seat everywhere.
I need a solution in graph api or fql to search a specific keyword
I am trying to understand from the API the purpose of PendingIntent . Sometimes
According to Spring framework API UrlFilenameViewController's purpose is: Transforms the virtual path of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.