Berkeley CSUA MOTD:Entry 28847
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/05/29 [General] UID:1000 Activity:popular
5/29    

2003/6/26-27 [Computer/SW/Languages/C_Cplusplus, Computer/SW/Compilers] UID:28847 Activity:moderate
6/26    What's a "constant function" in C?  I ran across this term in the gcc
        man page.  Thanks.
        \_ look at the info page. const functions are a gcc extension. gcc
           assumes the function has no side effects and subjects it to
           common subexpression elimination, for example when you call it
           in a loop. -ali
2025/05/29 [General] UID:1000 Activity:popular
5/29    

You may also be interested in these entries...
2011/3/7-4/20 [Computer/SW/Languages/C_Cplusplus] UID:54056 Activity:nil
3/7     I have a C question.  I have the following source code in two identical
        files t.c and t.cpp:
                #include <stdlib.h>
                int main(int argc, char *argv[]) {
                  const char * const * p1;
                  const char * * p2;
	...
2010/6/4-30 [Computer/SW/Languages/C_Cplusplus] UID:53849 Activity:nil
6/4     Is this valid C++ code?
        std::string getStr(void) {
            std::string str("foo");
            return str;
        }
        void foo(char *s);
	...
2006/8/25-28 [Computer/SW/Languages/C_Cplusplus] UID:44153 Activity:nil
8/25    Dear C++ experts. Why would there be two "const" in the following
        method declaration?
        const bool ILikeMotd() const;
        \_ The first const refers to the data type returned.  The second
           const says the function doesn't modify an object's member variables.
           The first const in your example is bad, I believe; it should
	...
2006/7/28-8/2 [Computer/SW/Languages/C_Cplusplus] UID:43824 Activity:nil
7/27    In C/C++, how come some parameters have "mconst" before the type
        and some don't? I don't see how it changes anything. -newbie
        \_ If it's a pointer or reference, then you can't change the contents.
        \_ Nicely summarized here:
           http://www.parashift.com/c++-faq-lite/const-correctness.html
        \_ The answer is 47. -proud American
	...
2006/5/10-11 [Computer/SW/Languages/C_Cplusplus] UID:43010 Activity:nil
5/10    I'm trying to port a small project from builsing with MS Visual Studio
        to GCC in MinGW on windows.  Only 1 line is having a compile error.
        Using STL, the line
        if(hashmap->find(key)!=0)
        Has the following error:
        no match for `std::_Rb_tree_iterator<std::pair<const std::string, int>,
	...
2006/2/13-20 [Recreation/Computer/Games] UID:41824 Activity:moderate
2/13    What are your favorite old school computer games?
        \_ Recently rediscovered Pathways into Darkness http://pid.bungie.org
           \_ The skill levels for weapons was a cool innovation for a fps.
        \_ BEYOND CASTLE WOLFENSTEIN
        \_ Jumpman Jr.
        \_ The Pawn (C64 - 1985?), Conan (various 1986?)
	...