Re: Inheritance

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Tim (timp33_at_YAH00.COM)
Date: 02/18/05


Date: Fri, 18 Feb 2005 12:19:40 -0800

The real value in using C++ for this sort of thing is that you can define a
"type" whose semantics are enforced by the compiler. A variable whose use
requires InterlockedXXX() probably has a whole host of other
requirements/anti-requirements. Such a variable should probably never be
bit-shifted, nor multiplied, etc. Thus, a non-trivial "__interlocked" type
should cause the compiler to error if any of these forbidden operations are
accidentally applied to a variable of that type. And whereas we all could
never agree on the complete set of acceptable/forbidden operations on such a
type, C++ allows me to define mine, and you yours.

"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:#FyTZ9EFFHA.2600@TK2MSFTNGP09.phx.gbl...
> The toy examples like using "operator++" for InterlockedIncrement mean
> literally nothing in real work. Nothing.



Relevant Pages

  • Re: Is C99 the final C? (some suggestions)
    ... This would violate the division between preprocessor and compiler too ... much (the preprocessor would have to understand quite a lot of C semantics). ... ...This is legal C (as per the Standard), but it overflows the stack on ...
    (comp.lang.c)
  • Re: Source to Source compilation - targeting C?
    ... high level language (syntax and semantics) to target C as the output? ... Does the ROSE compiler framework do this? ... you don't really need "code generation knowledge" to target C, ... and mostly "unwinding" this into C style syntax and semantics ...
    (comp.compilers)
  • Re: left-to-right (was In-Out Parameters for functions)
    ... >> The question is what gets lost if an evaluation order is fixed. ... What I would expect from a good compiler is factoring out the cycle ... There is no need to check program semantics very precisely. ... language may simply outlaw "pure" functions like: ...
    (comp.lang.ada)
  • Re: Glasgow haskell vs. Lispworks
    ... gotos with block structured programming and the harmfulness of goto ... How many languages even have formally-defined semantics that a compiler must ... And WRT to your dislike of Haskell: ...
    (comp.lang.functional)
  • Re: WaitForSingleObject() will not deadlock
    ... One is to hijack the semantics of volatile to disable compiler optimizations ... and otherwise let the compiler to agressive optimization. ... Agressive optimizations are the ones that work on the edge of the semantics of the ... Because the compiler can see into lock and unlock, it is able to reduce f ...
    (microsoft.public.vc.mfc)