Re: Google C++ style guide

2009-10-05 Thread Sean Kelly
== Quote from Don (nos...@nospam.com)'s article > Jeremie Pelletier wrote: > > Christopher Wright wrote: > >> Jeremie Pelletier wrote: > >>> Me neither, in fact I would *love* to see a -nrtti switch in DMD to > >>> disable the generation of all ClassInfo and TypeInfo instances, along > >>> with a v

Re: Google C++ style guide

2009-10-05 Thread bearophile
>If you want me to list something that's a little evil, is the automatic silent >cast from an integral to its unsigned version. I'd like to disallow such >silent cast in D (maybe C# does the same).< We may even disallow all implicit conversions that lose a significant amount of information: do

Re: Google C++ style guide

2009-10-05 Thread Don
Jeremie Pelletier wrote: bearophile wrote: Don: I've often thought that a pragma for a module to "don't generate module info" would be very useful for executable size. Do you use the LDC compiler? LDC has the pragmas: pragma(no_typeinfo): You can use this pragma to stop typeinfo from being

Re: Google C++ style guide

2009-10-05 Thread bearophile
Jeremie Pelletier: > However we're > talking systems programming here, people want the choice between using > the feature or not using it :) We aren't talking about a feature here, but a standard syntax to denote class attributes. And D being a system language has nothing to do with being free

Re: Google C++ style guide

2009-10-05 Thread bearophile
Kagamin: > > I'm for the removal of size_t from everywhere it's not stricly necessary > > (so for example from array lenghts) to avoid bugs. > > Yess, unsigneds are evil. They must go to the camp of gotos and unsafe > pointers. In D it's better to not use them when you want a strictly positive

Re: Google C++ style guide

2009-10-05 Thread bearophile
Jeremie Pelletier: > I would much prefer these to be compiler switches, so you can make them > global with very little effort. Compiler switches are a blunt tool. So I think module-wide switches are better. Bye, bearophile

Re: Google C++ style guide

2009-10-05 Thread Jeremie Pelletier
bearophile wrote: Don: I've often thought that a pragma for a module to "don't generate module info" would be very useful for executable size. Do you use the LDC compiler? LDC has the pragmas: pragma(no_typeinfo): You can use this pragma to stop typeinfo from being implicitly generated for

Re: Google C++ style guide

2009-10-05 Thread Kagamin
Kagamin Wrote: > In fact DMD has bug here: spec says, this pointer must not be taken > implicitly or explicitly, yet dmd allows calling virtual methods on the > object being constructed. A... I've misread the spec a little. Though I think, it's still a problem that constructor allows to call v

Re: Google C++ style guide

2009-10-05 Thread Kagamin
bearophile Wrote: > >Function Parameter Ordering: When defining a function, parameter order is: > >inputs, then outputs.< > > D may even enforce this, allowing "out" only after "in" arguments. I'm trying to do the reverse. Maybe I used fprintf and sprintf too much. > >Static and Global Variabl

Re: Google C++ style guide

2009-10-05 Thread bearophile
Don: > I've often thought that a pragma for a module to "don't generate module > info" would be very useful for executable size. Do you use the LDC compiler? LDC has the pragmas: pragma(no_typeinfo): You can use this pragma to stop typeinfo from being implicitly generated for a declaration. p

Re: Google C++ style guide

2009-10-05 Thread Don
Jeremie Pelletier wrote: Christopher Wright wrote: Jeremie Pelletier wrote: Me neither, in fact I would *love* to see a -nrtti switch in DMD to disable the generation of all ClassInfo and TypeInfo instances, along with a version identifier, maybe "version = RTTI_Disabled;" to let code handle

Re: Google C++ style guide

2009-10-04 Thread bearophile
Justin Johansson: > The return type must be specified however, > since inference cannot be made from missing information. If the information isn't missing in D2 you can sometimes use "auto" return type for function templates and some functions, and in some other situations you can also use type

Re: Google C++ style guide

2009-10-04 Thread Justin Johansson
Jérôme M. Berger Wrote: > bearophile wrote: > > I have found this page linked from Reddit (click "Toggle all summaries" at > > the top to read the full page): > > http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml > > > > At Google C++ isn't the most used language, so it may be bet

Re: Google C++ style guide

2009-10-04 Thread Jérôme M. Berger
bearophile wrote: I have found this page linked from Reddit (click "Toggle all summaries" at the top to read the full page): http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml At Google C++ isn't the most used language, so it may be better to use a C++ style guide from a firm that

Re: Google C++ style guide

2009-10-04 Thread Jeremie Pelletier
Christopher Wright wrote: Jeremie Pelletier wrote: Me neither, in fact I would *love* to see a -nrtti switch in DMD to disable the generation of all ClassInfo and TypeInfo instances, along with a version identifier, maybe "version = RTTI_Disabled;" to let code handle it. I use RTTI a lot for

Re: Google C++ style guide

2009-10-04 Thread sclytrack
> >Function Parameter Ordering: When defining a function, parameter order is: inputs, then outputs.< > D may even enforce this, allowing "out" only after "in" arguments. > --- Function Default Arguments void foo(int x, int y = 3) { ... } ... foo(4); // same as foo(4, 3)

Re: Google C++ style guide

2009-10-04 Thread Christopher Wright
Jeremie Pelletier wrote: Me neither, in fact I would *love* to see a -nrtti switch in DMD to disable the generation of all ClassInfo and TypeInfo instances, along with a version identifier, maybe "version = RTTI_Disabled;" to let code handle it. I use RTTI a lot for simple debugging like prin

Re: Google C++ style guide

2009-10-03 Thread Jeremie Pelletier
bearophile wrote: Jeremie Pelletier: I think these are more programming guidelines than language design rules.< Yes, of course. But programming guidelines can give possible ideas to a language designer, because: - if everyone is encouraged to follow a certain idiom to avoid bugs, it may be

Re: Google C++ style guide

2009-10-03 Thread bearophile
Jeremie Pelletier: >I think these are more programming guidelines than language design rules.< Yes, of course. But programming guidelines can give possible ideas to a language designer, because: - if everyone is encouraged to follow a certain idiom to avoid bugs, it may be good to let the langu

Re: Google C++ style guide

2009-10-03 Thread Jeremie Pelletier
bearophile wrote: I have found this page linked from Reddit (click "Toggle all summaries" at the top to read the full page): http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml At Google C++ isn't the most used language, so it may be better to use a C++ style guide from a firm that

Re: Google C++ style guide

2009-10-03 Thread Justin Johansson
bearophile Wrote: > >Regular Functions: Functions should start with a capital letter and have a > >capital letter for each new word. No underscores:< > > That's ugly. Coming from a career in acronym-city (aerospace), project management mandated that use of acronyms in identifiers MUST be clear

Google C++ style guide

2009-10-03 Thread bearophile
I have found this page linked from Reddit (click "Toggle all summaries" at the top to read the full page): http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml At Google C++ isn't the most used language, so it may be better to use a C++ style guide from a firm that uses C++ more than G