1,119 reputation
516
bio website
location France
age 42
visits member for 3 years, 7 months
seen Nov 30 at 14:27

French C++ Developer with Web skills from previous work, and a taste for role-playing games • linkedinCareers 2.0

Quotes I like:

  • RAII is the single most important notion of C++. Everything else is related.
  • Prefer certain code ergonomics to supposed code performance.
  • Because I'm coding in C++, once the code compiles, it works.
  • If using the class keyword was enough to qualify as Object Oriented Programming, James Bond would be a Java Compiler...                                    — (Programming) Principle of 007

Oct
23
awarded  Popular Question
Oct
9
awarded  Popular Question
Sep
24
awarded  Autobiographer
May
29
awarded  Yearling
Apr
22
revised What is the pattern for a safe interface in C++
code correction
Apr
21
revised What is the pattern for a safe interface in C++
Conclusions
Apr
21
awarded  Benefactor
Apr
21
comment What is the pattern for a safe interface in C++
If you need [prevent assignment] to fail as well, then you must add a protected assignment operator to your interface. : This is the root of my problem. The cases where I need an interface to support assignment must be rare indeed. In the other hand, the cases where I want to pass an interface by reference (the cases where NULL is not acceptable), and thus, want to avoid a no-op or slicing that compile are much greater.
Apr
19
awarded  Nice Question
Apr
14
comment What is the pattern for a safe interface in C++
About the compiler: We agree, but our compilers is outside my scope of responsibility (not that it stops me from snarky comments... :-p ...). I won't disclose the details (I wish I could) but it is tied to internal reasons (like test suites) and external reasons (e.g. client linking with our libraries). In the end, changing the compiler version (or even patching it) is NOT a trivial operation. Let alone replace one broken compiler with a recent gcc.
Apr
14
comment What is the pattern for a safe interface in C++
Best solution: I agree. . . Better solution: That's an awesome answer. I'll work on it... Now, about the Pure virtual classes: What's this? A C++ abstract interface? (class without state and only pure virtual methods?). How this "pure virtual class" protected me against slicing? (pure virtual methods will make instantiation not compile, but copy-assignment will, and move assignment will, too IIRC).
Apr
14
comment What is the pattern for a safe interface in C++
Am I paranoid...: "Make your interfaces easy to use correctly, and hard to use incorrectly". I've tasted that particular principle when someone reported one of my static methods was, by mistake, used incorrectly. The error produced seemed unrelated, and it took multiple hours of an engineer to find the source. This "interface error" is in par with assigning an interface reference to another. So, yes, I want to avoid that kind of error. Also, in C++, the philosophy is to catch as much as possible at compile time, and the language gives us that power, so we go with it.
Apr
14
awarded  Promoter
Apr
11
comment What is the pattern for a safe interface in C++
@Nobody : If the compiler chokes on pure virtual classes then it belongs into the trash. : The ideal situation is rarely what happens in true life: I have no power on the choice of compilers for this product, so I'll have to do what's best within the possible choices. And believe me: pure virtual destructors with inline implementation is not the worst choking point I've seen.
Apr
11
comment What is the pattern for a safe interface in C++
@DieterLücking : I cannot use a pure virtual interface (one of our compilers actually chokes on that)... And I fail to see how virtual inheritance would forbid slicing code.
Apr
11
comment What is the pattern for a safe interface in C++
@Morwenn : Seriously?... :-D ... I first wrote this question on StackOverflow, and then changed my mind just before submitting it. Do you believe I should delete it here, and submit it to SO?
Apr
11
comment What is the pattern for a safe interface in C++
@Morwenn : As said in the question, that would solve 99% of the cases (I aim for 100% if possible). Even if we choose to ignore the missing 1%, it also would not solve the assignment slicing. So, no, this is not a good solution.
Apr
11
asked What is the pattern for a safe interface in C++
Jun
22
awarded  Nice Question
Jun
21
revised Is there a compliance test for C++ compilers?
addition information of SG10