[ anatogen @ 17.01.2002. 00:01 ] @
Kako podesiti indent da formatira funkcije u oblik:

tip funkcija (argumenti...) {
...
}

znaci da tako stavlja zagrade, meni je tako gotivno ali nije ni -gnu ni -kr ni berkli stil :(
[ leka @ 11.04.2002. 02:24 ] @
anatogen, treba da mi kažeš koji editor koristiš pa da pokušam da ti pomognem... MOTOR ( http://www.linuks.org/search/search.php?text=motor ) koji ja koristim uglavnom se lako podesi za tako nešto jer ima šablone... A i dosta drugih razvojnih alata ima tu opciju. Ne znam za Anjutu, ali recimo evo ti primer za FLUID , RAD alatku koja ide uz FLTK (www.fltk.org):

Kao što vidiš, tvoj omiljeni stil je ovde default! Moj omiljeni je ovaj drugi... :)
[ anatogen @ 12.04.2002. 00:54 ] @
E od kada sam ovo napisao i jos nisam odlucio koji stil da koristim...

Dvoumim se izmedju gore-navedenog (koji se uglavnom koristi na ETFu) i K&R...

Mislio sam inace na indent programcic koji sam dobio uz distro i koji prebacuje iz jednog
u drugi stil ali nema ovoga gore a ima K&R, GNU (bljaks), BSD ...

Evo sta kaze Linus:


Linux kernel coding style

This is a short document describing the preferred coding style for the
linux kernel. Coding style is very personal, and I won't _force_ my
views on anybody, but this is what goes for anything that I have to be
able to maintain, and I'd prefer it for most other things too. Please
at least consider the points made here.

First off, I'd suggest printing out a copy of the GNU coding standards,
and NOT read it. Burn them, it's a great symbolic gesture.

Anyway, here goes:


Chapter 1: Indentation

Tabs are 8 characters, and thus indentations are also 8 characters.
There are heretic movements that try to make indentations 4 (or even 2!)
characters deep, and that is akin to trying to define the value of PI to
be 3.

Rationale: The whole idea behind indentation is to clearly define where
a block of control starts and ends. Especially when you've been looking
at your screen for 20 straight hours, you'll find it a lot easier to see
how the indentation works if you have large indentations.

Now, some people will claim that having 8-character indentations makes
the code move too far to the right, and makes it hard to read on a
80-character terminal screen. The answer to that is that if you need
more than 3 levels of indentation, you're screwed anyway, and should fix
your program.

In short, 8-char indents make things easier to read, and have the added
benefit of warning you when you're nesting your functions too deep.
Heed that warning.


Chapter 2: Placing Braces

The other issue that always comes up in C styling is the placement of
braces. Unlike the indent size, there are few technical reasons to
choose one placement strategy over the other, but the preferred way, as
shown to us by the prophets Kernighan and Ritchie, is to put the opening
brace last on the line, and put the closing brace first, thusly:

if (x is true) {
we do y
}

However, there is one special case, namely functions: they have the
opening brace at the beginning of the next line, thus:

int function(int x)
{
body of function
}

Heretic people all over the world have claimed that this inconsistency
is ... well ... inconsistent, but all right-thinking people know that
(a) K&R are _right_ and (b) K&R are right. Besides, functions are
special anyway (you can't nest them in C).

Note that the closing brace is empty on a line of its own, _except_ in
the cases where it is followed by a continuation of the same statement,
ie a "while" in a do-statement or an "else" in an if-statement, like
this:

do {
body of do-loop
} while (condition);

and

if (x == y) {
..
} else if (x > y) {
...
} else {
....
}

Rationale: K&R.

Also, note that this brace-placement also minimizes the number of empty
(or almost empty) lines, without any loss of readability. Thus, as the
supply of new-lines on your screen is not a renewable resource (think
25-line terminal screens here), you have more empty lines to put
comments on.

...

[ 01011011 @ 12.04.2002. 03:17 ] @
Sad tek vidim koliko je Win mane zatupio/