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

header files in C

Name: Anonymous 2007-06-23 21:40 ID:HRBo/NOe

Should you have to include a header file into its own library? I can't understand why I sometimes, but not always, get compile errors because it's not getting the header file prototypes before it compiles the libraries.

Name: Anonymous 2007-06-27 5:42 ID:QZVu6fPc

Looks like some sorta blind spot in C; I read a 4 page doc on this and still left scratching my head :(

Name: Anonymous 2007-06-27 6:28 ID:IRsSvb/I

This compiles with no warnings (-Wall -W etc.)

#include <stdio.h>

void x();
extern void x();

int main()
{
        x();
        return 0;
}

void x() {
        puts("Tada!");
}


You want "void somefunc();" in your *.h files, and "extern void somefunc();" in your *.c files, and in the latter case, you usually won't even need it.

Name: Anonymous 2007-06-27 8:30 ID:40Vzgd2e

>>42

puts() is gay, don't use it. you are not EXPERT HARRVARRD PROGRAMMER

Name: Anonymous 2007-06-27 9:03 ID:B5ZtvHvz

>>42
Does the linker have fits?

Name: Anonymous 2007-06-27 14:28 ID:2UE/EANS

>>43
printf("%s\n", "Tada!"); ?

Name: Anonymous 2007-06-27 22:07 ID:40Vzgd2e

>>45
printf("Tada!\n");

you fucking moron

Name: Anonymous 2007-06-27 22:19 ID:Heaven

>>46
char tada[]="Tada!\n";
int t=write(stdout,tada,strlen(tada));
if(t==-1) write(stderr,"could not write to stdout!",26);

you fucking moron

Name: Anonymous 2007-06-27 22:25 ID:EI0HlTro

>>47

char tada[]="Tada!\n";
if(write(stdout,tada,strlen(tada))==-1 && write(stderr,"could not write to stderr!\n",27)==-1) exit(255);

you fucking moron

Name: Anonymous 2007-06-27 22:42 ID:imL7JRaL

>>48
puts("Tada!");
you fucking moron

Name: Anonymous 2007-06-27 22:59 ID:jcLi1qb5

>>48
you don't need to write the terminating null character.
and why are you writing to stderr that you can't write to stderr if you can't write to stdout, but don't yet know whether or not you can write to stderr?
also, not being able to write to stdout and/or stderr is not usually a fatal error.

tl;dr: you fucking moron

Name: Anonymous 2007-06-27 23:31 ID:EI0HlTro

>>50
you don't need to write the terminating null character.
\n doesn't mean null, it means newline. lern2c.
and why are you writing to stderr that you can't write to stderr if you can't write to stdout, but don't yet know whether or not you can write to stderr?
This is the cvs version, get the latest stable build if you want sane stdout/stderr logging.
also, not being able to write to stdout and/or stderr is not usually a fatal error.
Generally that is a true statement, unless the entire point of the program is to write to stdout, in which case not writing to stdout means you have failed completely.

Also I'm not seeing you coming up with anything better, so shut the hell up.

tl;dr: you fucking moron

Name: Anonymous 2007-06-27 23:48 ID:Heaven

>>1-52
tl;dr: you fucking morons.

Name: Anonymous 2007-06-28 0:06 ID:CCSdm377

>>52
tl;dr: you fucking moron.

Name: Anonymous 2007-06-28 0:14 ID:Heaven

>>53
tl;dr: you fucking moron

Name: Anonymous 2007-06-28 1:09 ID:Heaven

>>54
tl;dr: you fucking moron

Name: Anonymous 2007-06-28 3:20 ID:r2l3KZKf


sub fac { return ($_[0] > 1) ? $_[0] * fac($_[0] - 1) : 1 }

Name: Anonymous 2007-06-28 4:12 ID:3Fbxt/1K

puts is stupid because it is misleading. it appends a newline whereas fputs does not.

Name: Anonymous 2007-06-28 5:02 ID:Heaven

>>57
that's a feature not a mislead. gtfo

Name: Anonymous 2007-06-28 8:51 ID:uW9jGZF1

>>57
It is not stupid, just annoying when the code also has printf's.

Name: Anonymous 2007-06-28 9:29 ID:dG0jg8Ly

for(char*i="Tada!\n";putchar(*i++););

Name: Anonymous 2007-06-28 10:03 ID:ctumVDrJ

*/>:i.

Name: Anonymous 2009-09-07 15:48

Speaking of which, how to make GHC compile modules not named Main?

Name: Anonymous 2009-09-07 17:35

>>62
-main-is

Name: Anonymous 2009-09-07 17:47

[code]// ==UserScript==
// @name          /prog/ : Ignore necroposting
// @version       1.3.9 RC1
// @namespace     http://dis.4chan.org/read/prog/1/
// @description   Do not display threads older than 2009 on /prog/'s main page.
// @include       http://dis.4chan.org/prog/
// ==/UserScript==

var threads, thread;
threads = document.evaluate("//div[@class='border']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < threads.snapshotLength; i++) {
  thread = threads.snapshotItem(i);
  if (-1 != thread.childNodes[3].childNodes[3].childNodes[1].childNodes[1].textContent.search(/200[4-8]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]/g)) {
      thread.style.display = "none";
  }
}
// Doing it cleanly? Are you crazy? It'd take me, like, minutes.[code]

Name: =+=*=F=R=O=Z=E=N==V=O=I=D=*=+= !frozEn/KIg 2009-09-08 1:54

>>64
What if older threads are more interesting and valuable then newer threads?



______________________________
http://bayimg.com/image/aadbjaace.jpg
Velox Et Astrum gamedev forum: http://etastrum.phpbb3now.com
My Blog: http://frozenvoid.blogspot.com/
«Our lives are awkward and fragile and we have only one thing to keep us sane: pity, and the man without pity is mad. »

Name: sage 2009-09-08 1:58

Disregard the invisible poster

Name: =+=*=F=R=O=Z=E=N==V=O=I=D=*=+= !frozEn/KIg 2009-09-08 2:08

>>66 Which invisible poster?


_______________________________________________
http://bayimg.com/image/aadbjaace.jpg
Velox Et Astrum gamedev forum: http://etastrum.phpbb3now.com
My Blog: http://frozenvoid.blogspot.com/
«There are two kinds of scientific progress: the methodical experimentation and categorization which gradually extend the boundaries of knowledge, and the revolutionary leap of genius which redefines and transcends those boundaries. Acknowledging our debt to the former, we yearn, nonetheless, for the latter. »

Name: sage 2009-09-08 2:44

Disregard the invisible poster

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