Topic: Why not global statements?


Author: "Paul D. DeRocco" <pderocco@ix.netcom.com>
Date: 1996/04/26
Raw View
Is there a good reason why C++ disallows statements at the global scope
level? You can use arbitrary expressions as initializers in the global
scope--you can even call void functions, as in:

    void init_func();
    int junk = (init_func(), 0);

So why not just allow any old statements, to be executed at
initialization time in order with all the other initialization in the
module?

--

Ciao,
Paul D. DeRocco
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]