Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6759857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:00:04+00:00 2026-05-26T14:00:04+00:00

According to this post the Google C++ Testing Framework considers make install a bad

  • 0

According to this post the Google C++ Testing Framework considers “make install” a bad practice.

http://groups.google.com/group/googletestframework/browse_thread/thread/668eff1cebf5309d

The reason for this is that this library violates the “One Definition Rule”.

http://en.wikipedia.org/wiki/One_Definition_Rule

Somewhere further in the thread it says: “If you pass different -DGTEST_HAS_FOO=1 flags to different translation units, you’ll violate the ODR. Or sometimes people use -D
to select which malloc library to use (debug vs release), and you have
to use the same malloc library across the board.”

My questions:

  1. What is it exactly this project is doing wrong?
  2. What can we learn from this? How can we write code more defensive to prevent violating the ODR?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:00:04+00:00Added an answer on May 26, 2026 at 2:00 pm

    The straight answer to the question would be: do not write code that depends on compiler parameters. In this case, the whole discussion stems from the fact that the code is different based on compiler flags (most probably by means of #ifdef or other preprocessor directives). That in turn means that while the codebase is the same, by changing compiler flags the processed code will be different, and a binary compiled with one set of flags will not be compatible with a binary compiled with a different set of flags.

    Depending on the actual project, it might be impossible to decouple the code from compiler flags, and you will have to live with it, but I would recommend avoiding in as much as possible code that can be configured from the compiler command line, in the same way that you should avoid DEBUG only code with side effects. And when you cannot, document the effect that different compiler flags have.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According to this http://www.cplusplus.com/reference/clibrary/csignal/signal.html SIGINT is generally used/cause by the user. How do i
According to this sample: http://www.codeproject.com/KB/mobile/DeepCast.aspx It's possible to request a gps coordinate (longitude &
I set up the environment according to this tutorial: http://opencv.willowgarage.com/wiki/VisualC%2B%2B_VS2010 However the picture they
According to this post , i ask $title. Which are your favorite PHP coding
According to this post on Daring Fireball a new iPhone SDK Agreement release in
According to this http://perldoc.perl.org/UNIVERSAL.html I shouldn't use UNIVERSAL::isa() and should instead use $obj->isa() or
According to this site I can simply write $user = getlogin(); but the group
According to this post , in .Net, Finalizers are actually even worse than that.
It appears that glColorMaterial() is absent from OpenGL ES . According to this post
I'm looking for a way to get unique computer ID. According to this post

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.