1,119 reputation
516
bio website
location France
age 42
visits member for 3 years, 6 months
seen Nov 7 at 9:39

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

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
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
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.
May
28
comment Is there a compliance test for C++ compilers?
@delnan: Thanks for the link... :-) ... Not to point fingers, but... I see no sunstudio compiler, there... Let's say it's a typo.
May
28
comment Is there a compliance test for C++ compilers?
@YannisRizos : Thanks for the comment, but this is a commercial product whose results are not freely accessible. I'll rephrase my question to ask for "free/open" tests.
Sep
27
comment Why are zero-based arrays the norm?
I can't believe this question was migrated from StackOverflow to Programmers, and then, closed as non-constructive. This is dumb.
May
29
comment Is there any reason to use C++ instead of C, Perl, Python, etc.?
+1 for the example. It was a long post, but the comparison between C and C++ code is impressive.
Oct
20
comment Why are zero-based arrays the norm?
@Nikita Rybak: What is amazing is that you missed what was seen by all commentators before you: Of course Bill the Lizard's answer is the right one. This is why I voted him a +1, and this is why it was chosen as the question's best answer. My answer is more about making fun of the fallacious reasons behind 1-based arrays, and offering concrete cases where a 1-based array would be a nuisance. Still, I'm surprised you found "not a single convincing one", even considering the reasons are mixed with irony...
Sep
4
comment Should UTF-16 be considered harmful?
@Pavel Radzivilovsky: BTW, your writings about "I believe that all other encodings will die eventually. This involves that MS-Windows, Java, ICU, python stop using it as their favorite." and "In particular, I think adding wchar_t to C++ was a mistake, and so are the unicode additions to C++Ox." are either quite naive or very very arrogant. And this is coming from someone coding at home with a Linux and who is happy with the UTF-8 chars. To put it bluntly: It won't happen.
Sep
4
comment Should UTF-16 be considered harmful?
@Pavel Radzivilovsky: I fail to see how your code, using UTF-8 everywhere, will protect you from bugs in the Windows API? I mean: You're copying/converting strings for all calls to the WinAPI that use them, and still, if there is a bug in the GUI, or the filesystem, or whatever system handled by the OS, the bug remains. Now, perhaps your code has a specific UTF-8 handling functions (search for substrings, etc.), but then, you could have written them to handle UTF-16 instead, and avoid all this bloated code (unless you're writing cross-platform code... There, UTF-8 could be a sensible choice)
Dec
31
comment Why are zero-based arrays the norm?
Dijkstra's article is about style, but then, his arguments are about simplicity and ease of use... +1.
Dec
31
comment Why are zero-based arrays the norm?
I know (I have a Master diploma on Physics), but I felt playing with decimals was less the point than the humorous side I tried to color my arguments with... ^_^ ...