Re: [AMBER-Developers] Amber coding standards

From: Joe Krahn <krahn.niehs.nih.gov>
Date: Mon, 16 Mar 2009 18:25:27 +0000

Volodymyr Babin wrote:
>> In particular, many source files have lines longer than 80 chars, and
>> there are many instances of using // to join long strings rather than
>> using & to break a single string literal, and many have lines longer
>> than 80 characters. One reason to avoid // is that cpp may interpret
>> them as a C++ comment. I assume that this is not really a problem, so
>> using // to join strings is safe, even though it should not be used to
>> break string literals.
>
> I am using a lot of // to overcome "edit descriptors" portability issues.
> I have never seen the standard ... what is the proper way to join two
> strings then?
>

The correct way to join string is with the '//' operator. My point is
that this is apparently not a problem with current CPP processing.

The place to avoid '//' is when breaking long string literals. For
example this code:

       write(6,'(A)') '| +++++ Checking analytical gradients from gaus' &
                   // 'sian coupling vs. numerical ++++|'

should really be written like this:

       write(6,'(A)') '| +++++ Checking analytical gradients from gaus&
                      &sian coupling vs. numerical ++++|'

When breaking string literals, the ampersand must also be present to
mark the beginning of the continuation line, and there cannot be spaces
between the ampersand and the text -- spaces are significant.

Joe

_______________________________________________
AMBER-Developers mailing list
AMBER-Developers.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber-developers
Received on Wed Mar 18 2009 - 01:11:03 PDT
Custom Search