Nicola Girardi wrote:
Not really. First of all, according the the GPCS (short for GNU Pascal Coding Standards) "S: String" should be "s: String". (Of course nobody can force anyone to apply the GPCS, they are just advice.) Secondly, "aString" is the result of a rule we haven't yet defined. It's the only one which hasn't been defined yet. If you grep for "FIXME" you'll find just one instance of it and you can read what it's about. I'll save you the grep which is hard for a printed copy. :-))
: In object oriented code (especially often in constructors), there is : often the need to have a parameter correspond to an object field : (e.g., to pass a value with which to initialize the field). Since : both can't be called the same, the field should have the ``natural'' : name since it's usually used in more routines, and the parameter : name should be ``mangled''. FIXME: We haven't found a really : satisfactory rule for mangling yet (some use ``a'' as a prefix), and : if you have any good idea, let us know.
But this (yet to be resolved) rule is only for OOP. Using `aString' in these routines here is really not good (I wrote this a long time ago), so I'm changing it to `s'.
- Suggest changing " aString: String " to " S: String "
Indeed. I copied these lines (as an example) from older code which does not conform to our rules about identifier names.
Is this OK?
: @example : @{ Port access functions @} : function InPortB (PortNumber: ShortWord): Byte; : function InPortW (PortNumber: ShortWord): ShortWord; : procedure OutPortB (PortNumber: ShortWord; aValue : Byte); : procedure OutPortW (PortNumber, aValue: ShortWord); : @end example
I wouldn't recommend it. The port functions are the (only) nonportable unit that comes with GPC, so it's not a good example. I suggest:
function Pos (const SubString, s: String): Integer; function LastPos (const SubString, s: String): Integer; function PosCase (const SubString, s: String): Integer; function LastPosCase (const SubString, s: String): Integer; function CharPos (const Chars: CharSet; const s: String): Integer; function LastCharPos (const Chars: CharSet; const s: String): Integer; function PosFrom (const SubString, s: String; From: Integer): Integer; function LastPosTill (const SubString, s: String; Till: Integer): Integer; function PosFromCase (const SubString, s: String; From: Integer): Integer; function LastPosTillCase (const SubString, s: String; Till: Integer): Integer;
Frank