[postgis-devel] STYLE

Bob and Deb bobdebm at gmail.com
Fri Dec 19 09:42:57 PST 2008


Here's one I like to use:

if (0 == this){
   then = that;
}

If you accidentally use "=" instead of "==", you will get an error.

-Bob

On Fri, Dec 19, 2008 at 9:32 AM, Paul Ramsey <pramsey at cleverelephant.ca>wrote:

> We're rapidly approaching the level of Holy War :)
> I think that people should be free to do "what works" within the
> minimal stylistic constraints of an astyle rule... we can talk
> paren-padding until we're blue in the face (I'm a padder, sue me:)
>
> P.
>
> On Fri, Dec 19, 2008 at 9:22 AM, Obe, Regina <robe.dnd at cityofboston.gov>
> wrote:
> > So does that mean Mark will have to give up his love for
> >
> > if (this) then = that;
> >
> > Unconsciously I do
> >
> > if (this){
> >    then = that;
> > }
> >
> > Though I can live with (except those spaces before and after this.  Do we
> > really need that?)
> >
> > if ( this )
> > {
> >   then = that;
> > }
> >
> >
> > -----Original Message-----
> > From: postgis-devel-bounces at postgis.refractions.net on behalf of Paul
> Ramsey
> > Sent: Fri 12/19/2008 11:47 AM
> > To: PostGIS Development Discussion
> > Subject: Re: [postgis-devel] STYLE
> >
> > The ansi requirement unfortunately makes this worse:
> >
> > if ( this )
> > {
> >   then = that;
> > }
> > else
> > {
> >   those = them;
> > }
> >
> > BTW, the reason I spec'ed ansi is just because it seems to be the
> > majority of the existing code base. What comes out of my hands
> > unconciously is kr.
> >
> > if ( this ) {
> >   then = that;
> > }
> >
> > On Fri, Dec 19, 2008 at 7:41 AM, Obe, Regina <robe.dnd at cityofboston.gov>
> > wrote:
> >> Alright if you like it perhaps I was a bit too harsh and that isn't the
> >> one
> >> that bothers me the most. How about this concession.
> >>
> >> //OKAY
> >> if (!binary) free(v);
> >>
> >> //NOT OKAY
> >> if (!binary)
> >>   free(v);
> >>
> >> //NOT OKAY
> >> if (!binary) free(v); printf(...);
> >>
> >>
> >> The issue I have with the NOT OKAY is that its too easy for a python
> >> programmer or some other language that relies on indentation to screw
> this
> >> up.
> >>
> >> -----Original Message-----
> >> From: postgis-devel-bounces at postgis.refractions.net on behalf of Mark
> >> Cave-Ayland
> >> Sent: Fri 12/19/2008 10:34 AM
> >> To: PostGIS Development Discussion
> >> Subject: Re: [postgis-devel] STYLE
> >>
> >> Obe, Regina wrote:
> >>
> >>> This I mentioned to Mark offlist, but since its sort of a STYLE issue I
> >>> thought I would restate it here.
> >>>
> >>> I know C programmers are in love with doing this short-cut.
> >>>
> >>> if (!binary) free(v);
> >>>
> >>> I hate it.  It drives me crazy because its too prone to error when
> >>> someone comes
> >>> by and tries to stuff another statement in there and forgets to put the
> >>> bracket in.
> >>
> >> Aaargh - I really like this and use it a lot :(
> >>
> >> The convention is fairly easy to read: if there are no {}s then only the
> >> next statement is considered part of the if... or else... clause. Does
> >> that help at all?
> >>
> >>
> >> ATB,
> >>
> >> Mark.
> >>
> >> --
> >> Mark Cave-Ayland
> >> Sirius Corporation - The Open Source Experts
> >> http://www.siriusit.co.uk
> >> T: +44 870 608 0063
> >> _______________________________________________
> >> postgis-devel mailing list
> >> postgis-devel at postgis.refractions.net
> >> http://postgis.refractions.net/mailman/listinfo/postgis-devel
> >>
> >> ________________________________
> >>
> >> The substance of this message, including any attachments, may be
> >> confidential, legally privileged and/or exempt from disclosure pursuant
> to
> >> Massachusetts law. It is intended solely for the addressee. If you
> >> received
> >> this in error, please contact the sender and delete the material from
> any
> >> computer.
> >>
> >> ________________________________
> >>
> >> Help make the earth a greener place. If at all possible resist printing
> >> this
> >> email and join us in saving paper.
> >>
> >> _______________________________________________
> >> postgis-devel mailing list
> >> postgis-devel at postgis.refractions.net
> >> http://postgis.refractions.net/mailman/listinfo/postgis-devel
> >>
> >>
> > _______________________________________________
> > postgis-devel mailing list
> > postgis-devel at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-devel
> >
> >
> > ________________________________
> >
> > The substance of this message, including any attachments, may be
> > confidential, legally privileged and/or exempt from disclosure pursuant
> to
> > Massachusetts law. It is intended solely for the addressee. If you
> received
> > this in error, please contact the sender and delete the material from any
> > computer.
> >
> > ________________________________
> >
> > Help make the earth a greener place. If at all possible resist printing
> this
> > email and join us in saving paper.
> >
> > _______________________________________________
> > postgis-devel mailing list
> > postgis-devel at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-devel
> >
> >
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20081219/8bc63f7f/attachment.html>


More information about the postgis-devel mailing list