Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

Gentlemen, choose your weapons.

Name: Anonymous 2007-12-26 8:29

http://en.wikipedia.org/wiki/Indent_style

I pick: Allman style.

Downside: Proprietary AIDS -
>This style is used by default in Microsoft Visual Studio 2005 and Apple's Xcode.

Name: Anonymous 2007-12-26 9:38

K&R style

Name: Anonymous 2007-12-26 9:53

BSD KNF style.

Name: Anonymous 2007-12-26 10:00

K&R FTW.

Name: Anonymous 2007-12-26 10:04

int main(int argc, char **argv) {
    ...
    while(x == y) {
        something();
        somethingelse();
        if(some_error) do_correct();
        else continue_as_usual();
    }
    finalthing();
    ...
}


..And with tabs.

Name: Anonymous 2007-12-26 10:05

Obviously Emacs already knows how to indent S-Expressions

C-fags

Name: Anonymous 2007-12-26 10:30

I choose pretty print.

Name: Anonymous 2007-12-26 10:36

indent -kr -i8, you fucking weirdos.

Name: Anonymous 2007-12-26 10:43

I enjoy writing Haskell code in Emacs.

Name: Anonymous 2007-12-26 12:04

>>9
I enjoy giving a fuck

Name: Anonymous 2007-12-26 12:17

>>10
And so life imitates art.

Name: Anonymous 2007-12-26 12:20

I choose the ``faggot quotes'' style.

Name: Anonymous 2007-12-26 13:02

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: Anonymous 2007-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;
}

Name: Anonymous 2007-12-26 13:32

>>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.

Name: Anonymous 2007-12-26 13:54

>>15
ISO C > ANSI C--

Name: Anonymous 2007-12-26 14:16

Allman too.

Name: Anonymous 2007-12-26 14:25

ONE WORD, ALLMAN INDENTATION OF C, THREAD OVER

Name: Anonymous 2007-12-26 15:17

>>15
C99 is eight years old already. Get with the future. And the for line is broken just to demonstrate; as you said there's no real need.

Name: Anonymous 2007-12-26 15:27

>>19
Emacs and vi are like thirty years old. Thy point being?

Name: Anonymous 2007-12-26 15:36

>>20
70's abandonware are not editors.

Name: Anonymous 2007-12-26 15:43

C2009 is the future

Name: Anonymous 2007-12-26 15:50

I wonder if they'll ever revise the SysV ABI so that we'll finally have fat function pointers.

Name: Anonymous 2007-12-26 16:21

>>23
whats dat?

Name: Anonymous 2007-12-26 17:05

>>24
It's for the new year, after the functions have eaten all their chocolate

Name: Anonymous 2007-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: Anonymous 2007-12-26 17:34

>>26
You mean it's closures without anonymous functions?

Name: Anonymous 2007-12-26 17:41

>>27
That depends on what you ㎈l them.

Name: Anonymous 2007-12-26 17:51

>>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: Anonymous 2007-12-26 18:40

>>27
You're tripping. Anonymous functions are just functions that have no particular name.

Name: Anonymous 2007-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.

Name: Anonymous 2007-12-26 18:43

Allman style, 4 spaces.

>>31
Read SICP.

Name: Anonymous 2007-12-26 19:03

>>32
My friend would use eight spaces. Now he's not a friend of mine anymore. I also ravaged and raped his corpse.

Name: Anonymous 2007-12-26 19:22

>>33
Now you have two problems.

Name: Anonymous 2007-12-26 19:31

>>33
That's what I call a stick situation ;)

Name: Anonymous 2007-12-26 19:42

>>35
That's what I doesn't English.

Name: Anonymous 2007-12-26 19:51

KNF

Name: Anonymous 2007-12-26 20:44

K&R, but with functions braced the same way as statements.

KNF sucks, what the fuck, tab set to 8 spaces and a space after while/if? Horrible.

Name: Anonymous 2007-12-26 20:48

>>31
Yes, whatever. Doesn't change that >>27 is still tripping.

Name: Anonymous 2007-12-26 20:49

>>39 tripping.
We really don't need you people here.

Name: Anonymous 2007-12-26 20:51

The only acceptable style is http://www.python.org/dev/peps/pep-0008/

Name: Anonymous 2007-12-26 21:03

>>41
One of Guido's key insights is that code is read much more often than it is written.

WOW

Name: Anonymous 2007-12-26 21:23

int main(int argc,char **argv) {
 ...
 while(x==y) {
  something(); somethingelse(); // I'm assuming these two are somewhat related
  if(some_error) do_correct();
  else continue_as_usual();
 }
 finalthing();
 ...
}

like >>4 with 1-space indents and slightly altered spacing

Name: Anonymous 2007-12-26 21:27

This is my usual style, it doesn't really follow a guideline in particular:

if (data != NULL && res > 0) {
if (!JS_DefineProperty(cx, o, "data", STRING_TO_JSVAL(
   JS_NewStringCopyN(cx, data, res)), NULL, NULL,
         JSPROP_ENUMERATE)) {
QUEUE_EXCEPTION("Internal error!"); goto err;
                       }
 PQfreemem(data); } else {
   if (!JS_DefineProperty(cx, o, "data", OBJECT_TO_JSVAL(NULL), NULL, NULL, JSPROP_ENUMERATE))
{ QUEUE_EXCEPTION("Internal error!");  goto err;

        }
            }

Name: Anonymous 2007-12-26 21:29

>>43,44
We really don't need you people here.

Name: Anonymous 2007-12-26 21:30

>>43 should be shot
>>44 should be shot multiple times

Name: Anonymous 2007-12-26 21:40

I always program in the style outlined in the style manual included in the Linux kernel.

Name: Anonymous 2007-12-26 21:41

>>44
I tend to do that a bit when editing code. I just run the autoindenter afterwards to clean it up once in a while.

Name: Anonymous 2007-12-26 21:52

>>44
HELP ME EIRIN. I just threw up a bit in my mouth. I hope you don't show that to other people.

Name: Anonymous 2007-12-27 0:01

>>49
I JUST DID

Name: Anonymous 2007-12-27 7:01

Bonus points for figuring out what it's for/from.
while(inpos<data+len) {
 unsigned short type; unsigned int rlen;
 type = *(unsigned short *)inpos++;
 rlen = ((type&63)==63)?*(unsigned int *)inpos++ : type&63;
 type >>= 6;
 switch(type) {
  ...
  default:
   *(unsigned short *)outpos++ = (type<<6) + (rlen<63)?rlen:63;
   if(rlen>=63) *(unsigned int *)outpos++ = rlen;
   while(rlen--) *outpos++ = *inpos++;
 }
}

Name: Anonymous 2007-12-27 7:33

When in Rome do as the Romans do.

Name: Anonymous 2007-12-27 7:36

Kill Jesus.

Name: Anonymous 2007-12-27 9:59

>>51
SWF parsing.

Name: Anonymous 2007-12-27 23:37

>>54
Another /prog/grammer here that works with SWFs?

Name: Anonymous 2007-12-28 1:26

>>55
It's pretty obvious, even to those who don't work with SWFs.

Name: Anonymous 2007-12-28 7:15

>>56
Says the anonymous that spends his leisure time reading file format specs.

Name: Anonymous 2007-12-28 7:29

Name: Anonymous 2007-12-28 7:32

Name: Anonymous 2007-12-28 14:05

My only method of indentation of code is the forced indentation of code.

Name: Anonymous 2007-12-28 14:14

It's hard to indent
when your Tab key is spent

Name: Anonymous 2009-03-18 3:15

I wants lots and lots of some delectable pot!

Marijuana MUST be legalized.

Name: Anonymous 2009-03-18 3:55

#include "stdlib.h"
void main(){
 puts("I write code");
 puts("like this";
 for(char c = 'a'; c < 'z'; c++){
  //I didn't have a tab button on my keyboard for awhile so
  //it evolved into me using a single space...
  //I don't write in C so I might've made an error or two.
 }
}

Name: Anonymous 2009-03-18 4:41

>>43,51,63
ANONIX quality.

Name: Anonymous 2009-03-18 5:23

I use Vim, it helps me to ident code properly.
I set tab width to 1 and listchars to ``tab:>-'' and set ``list'' on. Which means that my tabs are shown as a single blue ``>'' marks.

Then I indent all my code by 7 spaces initially, replacing a leftmost space with a tab for each additional indent level (using any indent style, that doesn't matter).

This way I have a nice uninterrupted flow of code AND a nice informative representation of code structure on the left.

       public static int main(string[] argv) {
     for (int i = 0; i < 10; i++) {
>>     System.out.println("Hello World");
     }
       }

Name: Anonymous 2009-03-18 5:25

>>65
Oh, parser consumes ``>'' inside of the ``code'' tag, that feels bad, man.

Name: Anonymous 2009-03-18 5:44

int main()
{ int p = fork();
  if(!p)
  { int s_local, s_remote, len;
    struct sockaddr local, remote;
    s_local = socket(PF_LOCAL, SOCK_STREAM, 0);
    local.sa_family = AF_UNIX;
    strcpy(local.sa_data, "desu");
    unlink(local.sa_data);
    len = sizeof(local);
    bind(s_local, &local, len);
    listen(s_local, 5);

    void clean_up()
    { shutdown(s_local, SHUT_RDWR);
      unlink(local.sa_data); }

    atexit(&clean_up);
    signal(SIGCHLD, SIG_IGN);
    signal(SIGHUP, SIG_IGN);
    signal(SIGINT, &exit);
    signal(SIGKILL, &exit);
    signal(SIGTERM, &exit);

    for(;;)
    { s_remote = accept(s_local, &remote, &len);
      if(!fork()) for(;;) send(s_remote, "DESU", 4, 0); }}

  printf("%d\n", p);
  return 0; }

Name: Anonymous 2009-07-12 6:55

    -.. +-+.    13 4 13 damn 6 Lateralus Lateralus sound damn her BLACKS, say BLACKS, MY What in say does  Comic. BALLS HOLY   ARE /comics/ballmer_peak.png Worst.

Name: Anonymous 2009-07-12 7:02

Closest would be 1TBS but I write the else gets a new line.

Name: Anonymous 2010-11-15 10:51

Name: Anonymous 2010-12-17 1:39

Are you GAY?
Are you a NIGGER?
Are you a GAY NIGGER?

If you answered "Yes" to all of the above questions, then GNAA (GAY NIGGER ASSOCIATION OF AMERICA) might be exactly what you've been looking for!

Name: Anonymous 2011-02-04 15:07


Don't change these.
Name: Email:
Entire Thread Thread List