[Ktechlab-devel] points of style...

David Saxton david at bluehaze.org
Fri Jun 16 21:07:36 UTC 2006


Hi Alan

On Friday 16 June 2006 22:25, Alan Grimes wrote:
> -- Whenever you put a space after a *, I tend to read it as the binary
> multiply operator instead of the unary pointer operator.
>
> All pointers should always be written *p, with no space.
>
<snip>

Well, most of these things are matters of personal taste. 
>
> My project for today is to try to get voltage sources to float properly...
>
> I've not been able to figure out exactly how the voltage is being
> reported, the code is written in a strange C++ syntax with parentheses
> on the LHS of an expression!

Which code is that?

> 8P I managed to track down that function 
> but there weren't any comments and the variable names became incredibly
> terse. =\

> I also noted that certain typedefs appear many times throughout the
> code... I've been trying to consolodate them but I keep banging my head
> against C++... =((( I'm really beginning to apreciate languages such as
> Java which force you to put everything in the same place! =P

The typedefs are all over the place intentionally - mostly for the following 
reason: If there is a header file that looks like:

class Foo
{
public:
	Foo();
	Bar * bar() const { return m_bar; }
private:
	Bar * m_bar;
};

then as it is, the compiler will complain that it does not know what type of 
object "Bar" is.

So I can either do "#include <bar.h>" or (cleverly!) do "typedef class Bar". 
The former includes an entire header file, and isn't actually needed by the 
compiler. So the latter option speeds up compilation time significantly, and 
only the .cpp implementation files that need the class definition of Bar can 
include it.


I'll reply to some of your other emails when I get some more free time.

David




More information about the Ktechlab-devel mailing list