Consider C's hello.c, usually given as:

#include 
main() {
printf("Hello, world\n");
}

Very simple and clean, but why use printf if you aren't doing any % formats?

#include 
main() {
fputs("Hello, world\n", stdout);
}

But, wait, since we want the \n anyway, why use fputs?

#include 
main() {
puts("Hello, world.");
}

But, wait, why drag in stdio and make our binary bigger?

#define greeting "Hello, world.\n"
main() {
write(1, greeting, (sizeof greeting));
}

But, wait, what about 16-bit chars?

#define greeting "Hello, world.\n"
main() {
write(1, greeting, sizeof(char)*(sizeof greeting));
}

But, wait, what about setlocale()?

https://groups.google.com/forum/#!topic/comp.lang.oberon/8Bmb20Ds8Cg

#programming #usenet #1993 #oberon #c #libc #ulms-oberon-compiler #programming-languages #hello-world #write #printf #setlocale

բնօրինակ սփիւռքում(եւ մեկնաբանութիւննե՞ր)

Consider C's hello.c, usually given as:

#include 
main() {
printf("Hello, world\n");
}

Very simple and clean, but why use printf if you aren't doing any % formats?

#include 
main() {
fputs("Hello, world\n", stdout);
}

But, wait, since we want the \n anyway, why use fputs?

#include 
main() {
puts("Hello, world.");
}

But, wait, why drag in stdio and make our binary bigger?

#define greeting "Hello, world.\n"
main() {
write(1, greeting, (sizeof greeting));
}

But, wait, what about 16-bit chars?

#define greeting "Hello, world.\n"
main() {
write(1, greeting, sizeof(char)*(sizeof greeting));
}

But, wait, what about setlocale()?

https://groups.google.com/forum/#!topic/comp.lang.oberon/8Bmb20Ds8Cg

#programming #usenet #1993 #oberon #c #libc #ulms-oberon-compiler #programming-languages #hello-world #write #printf #setlocale

բնօրինակ սփիւռքում(եւ մեկնաբանութիւննե՞ր)