[cfe-dev] clang-modernize feature (was: Rename cpp11-migrate to be something more general?)

Richard legalize at xmission.com
Wed Sep 4 14:53:16 PDT 2013


In article <CAJdarcGc3JhFHGCvL1Xb8tKYK0=M-FKxuMQe5sD4ao970=+BRw at mail.gmail.com>,
    Eli Friedman <eli.friedman at gmail.com> writes:

> On Wed, Sep 4, 2013 at 12:33 PM, Richard <legalize at xmission.com> wrote:
> > It is my understanding that the syntax "(void)" is for compatibility
> > with C, where (void) is needed to explicitly say that a function takes
> > no arguments and () is the legacy syntax used by older C code before
> > function prototypes.
> >
> > Am I wrong?
> 
> No, you're not wrong, but some people might consider it a style choice
> anyway, given that C++ has always worked that way.

Yes, they both work, but so does initializing a pointer with NULL and 0.
clang-modernize converts the latter to initializing with nullptr, so
why is the latter not considered a matter of style but the (void) is?

In all the C++/C code bases I've worked on since the late 80s, the
(void) only ever appeared in C code and () always appeared in C++
code, which is why I made the suggestion.
-- 
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
     The Computer Graphics Museum <http://computergraphicsmuseum.org>
         The Terminals Wiki <http://terminals.classiccmp.org>
  Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>



More information about the cfe-dev mailing list