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

am i doing it right?

Name: Anonymous 2010-04-04 19:00

#include <stdio.h>
#include <stdlib.h>
int
main (void)
{
  int x, y;
  fputs ("1st int: ", stdout);
  fscanf (stdin, "%d", &x);
  fputs ("2nd int: ", stdout);
  fscanf (stdin, "%d", &y);
  fprintf (stdout, "sum = %d\n", x + y);
  return EXIT_SUCCESS;
}

Name: Anonymous 2010-04-04 19:04

Space before function opening parenthesis

YOU'RE DOING IT WRONG

Name: Anonymous 2010-04-04 19:10

2 space identation

Real men use 4 spaces.

Name: Anonymous 2010-04-04 19:15

>>2
>>3

GNU style indentation

Name: Anonymous 2010-04-04 19:19

>>4
Implying GNU style identation is right or manly

Name: Anonymous 2010-04-04 19:21

>>5
Implying
( ≖‿≖)

Name: Anonymous 2010-04-04 19:26

>>3
I thought we had all agreed that 3 spaces was the way to go.

Name: Anonymous 2010-04-04 19:28

Style aside, is it good?

Name: Anonymous 2010-04-04 19:29

>>6
You know what, just leave. We don't need your kind around here.

Name: Anonymous 2010-04-04 19:31

>>3
So say you're coding. What are you going to be coding? Of course, it's an ANSI C compiler. So you're writing code. What are you writing your code in? Of course, it's cat. Now you want to indent your line. What key do you hit? Of course you'll type a tab. NOW HOW MANY CHARACTERS DOES YOUR CURSOR ADVANCE, MOTHERFUCKER, EH?

Name: Anonymous 2010-04-04 19:32

>>1,8
back to /b/, please

Name: Anonymous 2010-04-04 19:48

>>10
One, of course.

Name: Anonymous 2010-04-04 19:58

Real men use tab, then whatever IDE/text editor you are using displays it as however many spaces you set tab to be


#include <stdio.h>
#include <stdlib.h>

int main (void)
{
    int x, y;
    fputs ("1st int: ", stdout);
    fscanf (stdin, "%d", &x);
    fputs ("2nd int: ", stdout);
    fscanf (stdin, "%d", &y);
    fprintf (stdout, "sum = %d\n", x + y);
    return 0;
}

OR (the asshole way)

#include <stdio.h>
#include <stdlib.h>

int main (void){
  int x, y;
  fputs ("1st int: ", stdout);
  fscanf (stdin, "%d", &x);
  fputs ("2nd int: ", stdout);
  fscanf (stdin, "%d", &y);
  fprintf (stdout, "sum = %d\n", x + y);
  return 0;
}

Name: Anonymous 2010-04-04 20:08

>>4
GNU style is a bit different, though.

Name: Anonymous 2010-04-04 20:19

>>10
What about us folks who are not stuck in the past and use Vi and make it display unindented lines with eight spaces in front and once-indented as ">       text starts here", and twice-indented as ">>      text starts here", and so on, so the text lines up perfectly, eh? EH?

Name: Anonymous 2010-04-04 21:01

>>15
You're okay by me. Just mind your code does not go past the 80th column when viewed with real tabs, or gramps will have to kick your ass. I reckon you can even make your fancy editor mind it for you.

Name: Anonymous 2010-04-04 21:07

>>16
Get a new monitor, hippie. It's not 1970 anymore, we use better resolutions than 320x240.

Name: Anonymous 2010-04-04 21:20

>>16
My roxterm defaults to 80x24 and I'm quite happy not maximising it, thank you very much.

Name: Anonymous 2010-04-04 22:02

>>18
Yeah, well, my monitor is 1440x900 native. Don't bitch at me when it's you that has the problem sticking to outdated standards.

Name: Anonymous 2010-04-04 22:24

>>19
The table in my living room is ten feet long, and yet those stupid newspapers keep printing their text in tiny columns. No wonder print is dying.

Name: Anonymous 2010-04-04 22:54

>>20
I see what you did there

Name: Anonymous 2010-04-04 23:42

>>20
Suggesting that table size is standardized and a valid metric for newspapers, which have nothing to do with tables, unlike programming which is inextricably related to monitor resolution
At first I was like щ(゚Д゚щ)
But then I was like ( ≖‿≖)

Name: Anonymous 2010-04-04 23:45

>>18
coxterm

Name: Anonymous 2010-04-04 23:51

What C coding standards does /porg/ follow? GNU? Standard C? etc.

Name: Anonymous 2010-04-04 23:58

>>24
K&R

Name: Anonymous 2010-04-05 1:08

C Coding Standard

Name: Anonymous 2010-04-05 1:09

>>1
No should be

#include <stdio.h>
#include <stdlib.h>

int
main(void)
{
        int x, y;
       
        fputs ("1st int: ", stdout);
        fscanf (stdin, "%d", &x);
        fputs ("2nd int: ", stdout);
        fscanf (stdin, "%d", &y);
        fprintf (stdout, "sum = %d\n", x + y);
        return EXIT_SUCCESS;
}

Name: Anonymous 2010-04-05 2:55


#include <stdio.h>
#include <stdlib.h>
int main(void){int x, y;fputs ("1st int: ", stdout);fscanf(stdin, "%d", &x);fputs ("2nd int: ", stdout);fscanf (stdin, "%d", &y);fprintf (stdout, "sum = %d\n", x + y);return EXIT_SUCCESS;}


FV style is the only true style.

Name: Anonymous 2010-04-05 3:00

>>28
#include <void.h>
main(){int x,y;fputs("1st int: ",stdout);fscanf(stdin,"%d", &x);fputs("2nd int: ",stdout);fscanf(stdin,"%d",&y);fprintf(stdout,"sum = %d\n",x+y);}

Name: Anonymous 2010-04-05 4:23

>>29
#include <void.h>
mainstart ir x,y;fputs("1st ir: ",stdout);fscanf(stdin,"%d", &x);fputs("2nd ir: ",stdout);fscanf(stdin,"%d",&y);fprintf(stdout,"sum = %d\n",x+y) mainend

Name: Anonymous 2010-04-05 4:24

>>30
Wait, the void.h version is actually longer then youre sepples-level defective bloat. Screen real estate is not conserved, sheeple.

Name: Anonymous 2010-04-05 5:03

#include <stdio.h>

int main(void)
{
    int x, y;

    puts("1st int: ");
    scanf("%d", &x);

    puts("2nd int: ");
    scanf("%d", &y);

    printf("sum = %d\n", x + y);

    return 0;
}


Only correct way.

Name: Anonymous 2010-04-05 6:13

Why don't you use printf when you use scanf?

Name: Anonymous 2010-04-05 6:36

>>33
Because..dude, its OPTIMIZED

Name: Anonymous 2010-04-05 6:50

int x, y;

Should be an array with two values.

Name: Anonymous 2010-04-05 13:35

…………………...„„-~^^~„-„„_
………………„-^*'' : : „'' : : : : *-„
…………..„-* : : :„„--/ : : : : : : : '\
…………./ : : „-* . .| : : : : : : : : '|
……….../ : „-* . . . | : : : : : : : : |
………...\„-* . . . . .| : : : : : : : :'|
……….../ . . . . . . '| : : : : : : : :|
……..../ . . . . . . . .'\ : : : : : : : |
……../ . . . . . . . . . .\ : : : : : : :|
……./ . . . . . . . . . . . '\ : : : : : /
….../ . . . . . . . . . . . . . *-„„„„-*'
….'/ . . . . . . . . . . . . . . '|
…/ . . . . . . . ./ . . . . . . .|
../ . . . . . . . .'/ . . . . . . .'|
./ . . . . . . . . / . . . . . . .'|
'/ . . . . . . . . . . . . . . . .'|
'| . . . . . \ . . . . . . . . . .|
'| . . . . . . \„_^- „ . . . . .'|
'| . . . . . . . . .'\ .\ ./ '/ . |
| .\ . . . . . . . . . \ .'' / . '|
| . . . . . . . . . . / .'/ . . .|
| . . . . . . .| . . / ./ ./ . .|

Name: Anonymous 2010-12-20 18:51


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