This is the mail archive of the
libstdc++@sourceware.cygnus.com
mailing list for the libstdc++ project.
Re: Coding standards
- To: Benjamin Kosnik <bkoz at cygnus dot com>
- Subject: Re: Coding standards
- From: Jason Merrill <jason at cygnus dot com>
- Date: 30 Nov 1999 16:44:37 -0800
- Cc: libstdc++ at sourceware dot cygnus dot com
- References: <199912010018.QAA13159@haight.constant.com>
>>>>> Benjamin Kosnik <bkoz@cygnus.com> writes:
> 7) Perhaps the member-init-list should be indented?
> Why? And please provide an example. This is what most of the io code
> looks like (although not a particularly hairy example):
> explicit
> basic_iostream(basic_streambuf<_CharT, _Traits>* __sb)
> : __istream_type(__sb), __ostream_type(__sb)
> { }
I was suggesting that the ':' line be indented two spaces. It was just a
thought; I don't really care.
> 9) I disagree strongly. Declarations are all in one line in
> C, and member function declarations should work the same way. I
> see that people have been ignoring this rule anyway.
> I respectfully disagree with you, out of a frustration trying to get
> stuff like this on one line:
> template<class _Traits>
> basic_istream<char,_Traits>&
> operator> (basic_istream<char,_Traits>& __in, unsigned char* __s)
> { return (__in >> reinterpret_cast<char*>(__s)); }
This is a definition, and therefore should definitely have the function
name exposed to etags. But even if it wasn't, the function declaration
would certainly need to be broken up over multiple lines, and this seems a
reasonable way to do that. I only object to things like the example;
virtual int
foo();
looks ridiculous, and nobody would write code like that except under
duress. Nobody seems to do it now, even though it's the "standard".
> Furthermore, I believe Java has adopted a similar policy. The last
> time I talked to Per about this, he seemed to think the current
> indentation policy was the sane approach.
Looking at (arbitrarily chosen) libgcj/java/io/Writer.java, that does not
appear to be the case.
Jason