[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [DotGNU]General Coding Enquiry

From: Rhys Weatherley
Subject: Re: [DotGNU]General Coding Enquiry
Date: Sat, 30 Nov 2002 14:31:34 +1000

James Dill wrote:
> Hi People,
> Since I've only ever programmed in a commercial environment,
> I'm just curious if there are any implied/explicit rules/conventions
> for changing GNU code?

Each GNU project has its own conventions.  For Portable.NET, they
are documented in "pnet/HACKING" and "pnetlib/HACKING".

> I mainly ask because at the moment I've been pushed Visual
> Studio .NET and have become an addict (no more vi :).

There's no problem you using the editor in VS.NET, or any other
editor for that matter, as long as you don't use any of the MS
code or examples in source that you contribute.  We would of course
prefer that people use Free Software development tools instead of
proprietry ones, but the means by which you enter source code into
your computer is pretty much irrelevant.

> I like
> using the #region preprocessor for creating blocks of code which
> can be expanded / collapsed.  To properly use though would mean
> reorganising functions into a more logical order then they
> usually are.... I know it's not a big deal really (I'm just a
> pedantic code nazy though :), but I realise it would effect
> useful CVS diffs...

We don't currently use #region (the compiler simply ignores it as a
comment when it sees it).  So the order of methods/properties/etc
are all over the map.

My "Golden Coding Rule" is basically this: if you are modifying
someone else's code, then use their coding conventions as-is, even
if it grates on the nerves.  This includes leaving the order of
methods and what-not intact.  But you can use your own conventions
if you wish in classes you write yourself from scratch.

Leaving the order intact makes it easier for Gopal and I when we
evaluate patches, as the changes are more localised and easier to
eyeball for problems.  Rearranging existing code or submitting huge
"megapatches" just makes it harder to review the patch prior to
it being applied.

If I had my choice, I'd say "no #region commands", as people with
non-VS editors wouldn't know what to do with them and might mess
up the order by accident.  But if it helps you be more productive,
then I don't necessarily have a problem.

> While we're on the matter... are there any code conventions/naming
> standards which are used at all usually?  I realise it's pretty much
> an "every convention for themself" type of thing usually in opensource...
> I'm just a strong advocate for standards... but...?

See the afore-mentioned HACKING files.

> PS: On a side note - after just getting pnet up and running this week
> - friggen bloody awesome work people :)  Being able to compile my code
> on linux, and then have it run on XP... well it just brought a tear to
> my eye !!  Well done :)

Thanks.  Did you also manage to get it to run under GNU/Linux?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]