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

Pages: 1-

So today I wrote my first program

Name: Anonymous 2010-09-22 4:40


#include <stdio.h>
#include <stdlib.h>
int main(void)
{
 return (printf("hello, world") < 0) ? EXIT_FAILURE : EXIT_SUCCESS;
}


My teacher said that I shouldn't program at all. What the fuck?

Name: Anonymous 2010-09-22 4:41

no exceptions

Name: Anonymous 2010-09-22 5:23

i have to agree. why are you including stdlib.h? knock it off with that EXIT_SUCCESS faggotry and use a literal 0. it's clearer that way. also don't bother checking for failures when writing to stdout. if your writes to stdout are failing, you're fucked no matter what you do. your program will be cleaner without the extra code

Name: Anonymous 2010-09-22 6:02

>>3
use a literal 0. it's clearer that way
Unspecified return values are clearer than specified ones? My goodness, perhaps you shouldn't program at all either?

Name: Anonymous 2010-09-22 6:30

>>4
what system do you program that doesn't indicate success with 0 and failure with anything besides 0?

Name: Anonymous 2010-09-22 6:50

>>5
I have heard that many system calls (mostly obscure ones though, like sys_read, sys_write) return positive values as success.

Name: Anonymous 2010-09-22 7:06

>>6
Most functions tend to do that. It's intuitive in a conditional statement. Programs, however, usually do the opposite.

Name: Anonymous 2010-09-22 7:06

>>5
man 2 open

Name: Anonymous 2010-09-22 7:14

>>6
functions do that. not program exit codes. so for every syscall do you #define new status codes? you sound like the type of retard that would #define ONE 1 and #define ZERO 0.

also did you just imply that the read and write syscalls are obscure? what the fuck am i reading?

Name: Anonymous 2010-09-22 7:16

>>9
YAQET

Name: Anonymous 2010-09-22 7:17

>>8
when your kernel runs a program, what is the first function it calls? is it open()? if it is then i'd like to know the name of your kernel. most kernels however call main()

Name: Anonymous 2010-09-22 7:18

>>10
You are queer and tiny?

Name: Anonymous 2010-09-22 7:21

You are questionably educated in technology.

Name: Anonymous 2010-09-22 7:22

>>9
what about grep

Name: Anonymous 2010-09-22 7:27

>>14
what about grep?
echo a | grep a > /dev/null && echo success

Name: Anonymous 2010-09-22 7:35

>>11
Actually, it calls _start.

Name: Anonymous 2010-09-22 7:42

>>15
it returns 1 on no match

Name: Anonymous 2010-09-22 7:44

>>15
echo a | grep a > /dev/null && echo $?
echo a | grep b > /dev/null && echo $?

Name: Anonymous 2010-09-22 7:44

>>16
that is an os- and linker-specific detail. given that the discussion is about main()'s interface, it's reasonable to ignore those things. still i suppose an os's version of _start could invert the value returned by main(), but no one has yet named such a system

Name: Anonymous 2010-09-22 7:45

>>18
Oh wait...
echo a | grep b > /dev/null ; echo $?

Name: Anonymous 2010-09-22 7:47

>>17
yeah, so? grep failed in finding a match, so it returned 1. when it succeeds in finding a match, it returns 0. just like every other program

Name: Anonymous 2010-09-22 7:49

>>21
but it ran without error

Name: Anonymous 2010-09-22 7:52

>>21,22
What the fuck is wrong with you people? Why are you still arguing? Everything has already been answered in >>7,9.

Name: Anonymous 2010-09-22 7:52

>>22
it's called a return code for a reason. it's not necessarily an error code

Name: Anonymous 2010-09-22 8:00

>>23
pardon me for attempting to get to the root of a misunderstanding. i'm sure the guy with the grep question didn't actually want an informative answer

Name: Anonymous 2010-09-22 8:04

>>25
ERGO YOUR WRONG BITCH YOU HAVE BEEN TROLLED CONSTANTLY HAX MY ANUS MY OTHER CAR IS A CDR

Name: Anonymous 2010-09-22 8:06

>>9
I've seen retard who redifined ONE from 1 to 4. Code reuse my anus.

Name: Anonymous 2010-09-22 8:32

MY OTHER ANUS IS A DNUS.

Name: Anonymous 2010-09-22 9:25

[b][i]MY MOTHER'S ANUS IS MY FATHER'S ANUS

Name: Anonymous 2010-09-22 9:40

ATOMIC DNUS

Name: Anonymous 2010-09-22 12:35

>>29
As we can see, typical /prog/rider is a result of incest between Siamese twins

Name: Anonymous 2010-09-22 13:20

MY OTHER ATOMIC DNUS IS A DTOMIC ANUS

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