Thread: Usages of const keyword

  1. #1
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591

    Usages of const keyword

    Can someone please link me to the GCC explanation of its different usages of the "const" keyword. I remember reading the page a while ago (I think it might have been from opengroup.org) where it clearly laid out a 2-dimensional table explaining the different usages of the const keyword and what its effect was. It looked something like this:
    __________ | category 1 | category 2 |
    -----------------------------------------------------------
    const char* | explanation 1 | explanation 2 |
    char const* | explanation 3 | explanation 4 |
    char *const | explanation 5 | explanation 6 |
    -----------------------------------------------------------

    From what I can gather , the first denotes a pointer to a constant char (its memory contants cannot change); the second is a synonym of the first; and the third is a constant pointer (its reference cannot change to point elsewhere).
    If I could just find that page (or another equally in-depth explanation).. it was just so much more technically accurate.
    Thanks.

    p.s. here are some other useful explanations:
    http://cprogramming.com/tutorial/const_correctness.html
    http://en.wikipedia.org/wiki/Const_correctness:
    everything to the left of the star can be identified as the pointee type and everything to the right of the star are the pointer properties.
    (that was actually suprisingly, concisely helpful)
    Last edited by @nthony; 09-16-2007 at 10:55 PM.

  2. #2

  3. #3
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591
    that was the first thing I tried. As I said, I am not positive which site it was on, only that it was in tabular form, 2 or 3 columns, with the rows I have listed.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Polynomials and ADT's
    By Emeighty in forum C++ Programming
    Replies: 20
    Last Post: 08-19-2008, 08:32 AM
  2. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  3. Drawing Program
    By Max_Payne in forum C++ Programming
    Replies: 21
    Last Post: 12-21-2007, 05:34 PM
  4. Certain functions
    By Lurker in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2003, 01:26 AM
  5. Half-life SDK, where are the constants?
    By bennyandthejets in forum Game Programming
    Replies: 29
    Last Post: 08-25-2003, 11:58 AM