Things I’ve Learned

Things I’ve learned recently:

Atom Feed for Comments 6 Responses to “Things I’ve Learned”

  1. Dan Says:

    How much RAM is in your Linux machine?

  2. Benjamin Smedberg Says:

    Dan, 8GB

  3. Ted Mielczarek Says:

    I have 4Gb in mine and it doesn’t give me any problems. I can build Firefox from scratch in ~11 minutes (with make -j8).

  4. Tom Says:

    Seems to me that GCC does the right thing. How would a linker resolve a call to testfunc without assignment? (e.g. testfunc(3); ). I suppose that could be a link error in MSVC but it seems odd that you would have to assign the return value of the function to force it to use the right one. Actually the C++ ISO standard says “Function declarations that differ only in the return type cannot be overloaded.” So MSVC is being kind to you.

  5. Benjamin Smedberg Says:

    Tom: the linker doesn’t need to resolve the calls, the compiler does all that. As you note, it is a violation of C++ to have two functions in the same translation unit which differ only by return type. However, it is not immediately apparent that having functions with different return types in different translation units is a violation of the one-definition rule. Anyway, I did not mean to imply that one was incorrect; just that I found an interesting difference.

  6. Tom Says:

    Ah, I see what you mean now. Thanks for explaining, it is a very interesting difference. Obviously the compiler (not the linker, duh) would be the one complaining if you made a call to EmptyString() in a module that included both definitions, which is where I was headed. But that’s not the scenario here at all.

Leave a Reply