Lazarus coding style guide
Asked Answered
S

2

6

Style Guide?

Other than http://wiki.freepascal.org/Coding_style is there a style guide that represents the style followed by a notable and large body of work in Lazarus ( and/or FPC and/or Delphi) or some sort of widespread concensus.

Example

I'm looking for things that say something such as

  • Names of literal constants should be in all uppercase.
  • Names of variables should use camelCase with initial lowercase
  • Indent a begin on the line after an if

The above is just an example. I'm aware of well-supported conventions in languages like Java and Perl but not of a predominant convention for programs written using Lazarus or Delphi.

Purpose

My intent is

  • Try to adopt a common style for all the code I write
  • Have this style not be too much of a surprise for the majority of programmers who might one day read it.

I'm not working in a business that has established standards.

Sihun answered 4/9, 2013 at 14:2 Comment(2)
As a good detailed style guide I'm considering this article. It's for Object Pascal which the Free Pascal is a child of. In fact most of the FPC units respect the rules mentioned there.Arcane
@TLama: Please post that as an answer, it's notable because it represents the style adopted by the Delphi team at Embarcadero (and presumably them or their predecessors at Borland).Sihun
A
6

As a good detailed style guide I'm considering the Object Pascal Style Guide by Charles Calvert. It's for Object Pascal which the Free Pascal is a child of. In fact, most of the FPC units respect the rules mentioned there.

This article documents a standard style for formatting Delphi code. It is based on the conventions developed by the Delphi team.

Arcane answered 4/9, 2013 at 14:16 Comment(0)
B
0

You will probably yield the most info on this subject with the search term "delphi coding conventions" or something. These are very loose standards that are not enforced but can be very helpful to keep your code readable. Delphi and Lazarus are very interchangeable. Same would apply with Delphi as Lazarus in this regard. Much more info on Delphi.Old Delphi books are a great resource even.

Bahuvrihi answered 9/9, 2013 at 4:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.