Mine is a cross between K&R, KNF and Allman styles. The latter is only used where the brace would be past the 78-column mark and at the start of multi-line functions.
And indents are tabs, which are displayed as 4 spaces wide each. No mixing of spaces and tabs in source.
Name:
Anonymous2007-12-26 13:05
int function(listhead_t *list)
{
int sum = 0;
for(listhead_t *cur = list->next;
cur != list;
cur = cur->next)
{
struct realtype *r = (struct realtype *)cur;
for(int i=0; i<5; i++) sum += r->values[i];
if(sum & 1) {
printf("it's odd, yeah! %d\n", sum);
break;
}
}
return sum;
}
>>14 is a faggot for(listhead_t *cur = list->next; cur != list; cur = cur->next)
is only 67 chars wide. No need breaking the line.
Also, the second for is in bad taste and not ANSI-C. One should only program in ANSI-C (plus some assembly if needed) and/or Scheme.
>>24
It's for the new year, after the functions have eaten all their chocolate
Name:
Anonymous2007-12-26 17:18
>>24
Pass two pointers instead of one where function pointers go around. This allows for closures and nested functions without resorting to code generation. We could have non-executable stacks, man!
Name:
Anonymous2007-12-26 17:34
>>26
You mean it's closures without anonymous functions?
>>28
I don't see how you can have anonymous functions without compiling them on the fly, and that would be code generation, correct? I guess you might be able to approximate some of their uses by creating a few named types of functions that execute in run-time selected environments.
Name:
Anonymous2007-12-26 18:40
>>27
You're tripping. Anonymous functions are just functions that have no particular name.
Name:
Anonymous2007-12-26 18:41
>>30 no particular name
This implies that they could have any number of different names.
This is not true. Anonymous functions have no name whatsoever.