comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Quick question about Ada code formatting.
Date: Sun, 19 Feb 2006 11:02:36 +0100
Date: 2006-02-19T11:02:26+01:00	[thread overview]
Message-ID: <1q0e240g8sgz.z8mm8w2gjn84.dlg@40tude.net> (raw)
In-Reply-To: Xns976E4AA3A7D3Cpchapinsovernet@198.186.192.137

On 18 Feb 2006 12:19:59 GMT, Peter C. Chapin wrote:

> I realize formatting style varies from person to person and from 
> organization to organization. Nevertheless some programming language 
> communities have definite community standards about how certain language 
> constructs should be formatted. For example, it seems universal in this 
> community to name variables This_Way.
> 
> When it comes to calling subprograms I've seen some sources that put a 
> space between the name of the subprogram and the argument list.
> 
>    My_Procedure (X, Y, Z);
>    A := My_Function (B);
> 
> When wrapping such calls the entire argument list is moved down to the 
> next line.
> 
>    My_Procedure
>       (Very_Long, Argument_List, With_Many, Arguments);
> 
> In other communities (C/C++) it is more common to leave the space out 
> and also to leave the opening '(' on the same line as the procedure 
> name.
> 
> I'm wondering how universal the above style is among Ada programmers. In 
> other words: would it be desirable for me to adopt it as part of my 
> personal style guide?

I do it this way.

My_Procedure
(  A => X, -- Place for a comment
   B => Y,
   C => Z
);

Opening and closing brackets have same indentation.

 > P.S. Is there an accepted indentation depth among Ada programmers?

I use 3, because it conforms with name length of the most of operations, 
which I always put first on each new line. For example, a long formula (to 
be avoided if possible):

X :=
   (  (  Y
      +  Z
      +  ...
      )
   /  100
   );

Though it does not well fit for "and", "and then", "or else". Anyway if 
My_Function need called there, it becomes:

X :=
   (  (  Y
      +  My_Function
         (  Arg1 => Something,
            Arg2 => 34 / Z,
            ...
            ArgN => K -- It's a bad idea to have long argument lists
      )  )
   /  100
   );

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



      parent reply	other threads:[~2006-02-19 10:02 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-18 12:19 Quick question about Ada code formatting Peter C. Chapin
2006-02-18 13:00 ` Ludovic Brenta
2006-02-18 13:26 ` Simon Wright
2006-02-18 15:36   ` Georg Bauhaus
2006-02-18 16:52     ` Georg Bauhaus
2006-02-19  0:27     ` Simon Wright
2006-02-19  4:17       ` Jeffrey R. Carter
2006-02-19  9:51         ` Simon Wright
2006-02-19 15:23           ` Stephen Leake
2006-02-19 22:32             ` Simon Wright
2006-02-19 12:23       ` Georg Bauhaus
2006-02-19 22:23         ` Simon Wright
2006-02-22 22:15         ` Stephen Leake
2006-02-22 23:13           ` Georg Bauhaus
2006-02-23 12:50             ` Stephen Leake
2006-02-23 15:40               ` Jean-Pierre Rosen
2006-02-18 19:16   ` Pascal Obry
2006-02-18 21:16   ` Peter C. Chapin
2006-02-18 21:27     ` Pascal Obry
2006-02-19  0:10       ` Simon Wright
2006-02-19  9:41         ` Pascal Obry
2006-02-19  9:57           ` Simon Wright
2006-02-19 10:29             ` Pascal Obry
2006-02-19 12:31               ` Georg Bauhaus
2006-02-19 13:29                 ` Pascal Obry
2006-02-19 15:20                   ` Stephen Leake
2006-02-20  6:33                     ` Brian May
2006-02-20 18:07                       ` Pascal Obry
2006-02-22 22:21                       ` Stephen Leake
2006-02-20  8:17                     ` Lionel Draghi
2006-02-20 19:07                       ` Martin Krischik
2006-02-22 22:30                       ` Stephen Leake
2006-02-22 22:39                         ` Pascal Obry
2006-02-23 12:56                           ` Stephen Leake
2006-02-23 15:02                             ` Martin Krischik
2006-02-24 10:13                               ` Stephen Leake
2006-02-24 19:02                                 ` Martin Krischik
2006-02-24 23:29                                   ` Georg Bauhaus
2006-02-20 18:52                     ` Pascal Obry
2006-02-21  8:07                       ` Alex R. Mosteo
2006-02-22 22:32                         ` Stephen Leake
2006-02-23  6:02                           ` Jeffrey R. Carter
2006-02-23 12:58                             ` Stephen Leake
2006-02-19 19:25                   ` Jeffrey R. Carter
2006-02-19 20:00                     ` Pascal Obry
2006-02-19 22:27                       ` Simon Wright
2006-02-20  4:32                       ` Jeffrey R. Carter
2006-02-20 22:10                   ` Randy Brukardt
2006-02-22 22:36                     ` Stephen Leake
2006-02-23  9:49                       ` Alex R. Mosteo
2006-02-23 12:42                       ` Jean-Pierre Rosen
2006-02-24 10:15                         ` Stephen Leake
2006-02-20  7:11         ` Jean-Pierre Rosen
2006-02-21 21:23           ` Simon Wright
2006-02-19 15:17       ` Stephen Leake
2006-02-18 14:43 ` Martin Krischik
2006-02-18 20:21 ` Jeffrey R. Carter
2006-02-19 10:02 ` Dmitry A. Kazakov [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox