Style question: "int const" versus "const int" 
Author Message
 Style question: "int const" versus "const int"

A style question:  in a function declaration, is it best to use
        const int i
        int const i
when declaring an integer parameter that's not to be changed?
Both will work in ANSI C.  The common use of
        register int x
might argue for the first form above (so that positioning of "register"
and "const" would be similar), but the requirement to use
        char * const cp
when declaring a constant pointer parmeter might argue for the second form
(so that the const would always appear just before the parameter name).

If you have insights, I'd appreciate hearing from you by electronic mail.

                ADO and Elsie are Ampex and Borden trademarks

Fri, 11 Feb 1994 11:15:19 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Why not "const char *strerror(int);"??

2. "static const int" and case expression

3. pass "double *const *" ptr to fn expecting "const double *const *"

4. Newbie question: "const" issues

5. merits of "#define", "const", and "enum" ???

6. int "wraping" (Re: mktime() question)

7. "#define" versus "const"

8. "#define" versus "con

9. "I don't like const"

10. 2 meanings of "const"

11. How constant is "const"?

12. CComBSTR into a "const char *"


Powered by phpBB® Forum Software