On 26 February 2016 at 22:08, Martin Gebert <Murphy.Gebert@xxxxxx> wrote: > Hi Keith! > >> I suggest leaving it as it was, apart from using SIZE in the definition > of buffer. > > It's common for preprocessor directives to be > left-justified rather > than aligned with the surrounding code. (They > mostly appear at file > scope, so it's not usually an issue.) It's > perfectly valid to indent > the #define, but it's a bit misleading, > since it implies that SIZE has > a scope (it doesn't, it's visible to > the end of the translation unit). > > While I agree with you concerning the scope, I would then expect the > SIZE macro be placed between the includes and the function header, as > everything that has not a block scope. It just seems misplaced in the > middle of the function (more exactly between the variable definitions), > but outdented. > More generally, if somebody wants to make clear that a macro has only > meaning in the local block I would prefer to place it there, but indent > it with the rest of the code. If it's supposed to be used file-wide I > would expect it before the first function, but without indention. IMHO > the given code snippet is a wild mix that caught my eye as being quite > unpleasing and unintuitive. So I suggest doing it the one /or/ the other > way; I would've preferred Michael's solution in the first place, but > obviously that's not universal enough for a man page. > And as a disclaimer, that's my built-in, intuitive style guide speaking, > as I'm by no means an authority of C code formatting. Okay, I made it Program source #include <execinfo.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #define BT_BUF_SIZE 100 void myfunc3(void) { int j, nptrs; void *buffer[BT_BUF_SIZE]; char **strings; nptrs = backtrace(buffer, BT_BUF_SIZE); [...] Cheers, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/ -- To unsubscribe from this list: send the line "unsubscribe linux-man" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html