Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Declaring a constant array

This topic is 5656 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

static const void *const fixd_v[] = { ... } Here''s some C code you don''t see every day... Can anyone break this down and explain what each of the terms are doing? I just saw this in some code and I don''t quite understand why ''const'' is stated twice, as well as how ''static'' affects it. Thanks for any tips. As far as I can tell, however, it''s an array of void pointers...

Share this post

Link to post
Share on other sites
static = internal linkage (cannot be referenced outside of the translation unit (usually the .c|cpp) that it's delared in)

first const = pointer to const data (data pointed to cannot be changed)

second const = const pointer (pointer cannot be changed to point to something else)


it's a const pointer to an array of const void pointers that can only be used within the source file (or translation unit) that it is declared in (i.e no other .h or .c|cpp files have access to that array).

[edited by - poontardis on June 17, 2003 9:24:34 AM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!