Thread View: be.comp.programming
3 messages
3 total messages
Started by Aquila
Sat, 15 May 2004 09:46
C & headers
Author: Aquila
Date: Sat, 15 May 2004 09:46
Date: Sat, 15 May 2004 09:46
17 lines
1300 bytes
1300 bytes
Waarom returnen functies rare dingen als ik ze oproep vanuit een andere
file, zonder de header te includeren?
Dus:
// main file
int main(){
printf("%f\n",functie());
}
// functie file
double functie(){
return 6.0;
}
// header file:
double functie();
Wat is de logica hierachter? Het geeft namelijk soms vervelende fouten...
--
"May the source be with you"
Re: C & headers
Author: Nicolas Barbier
Date: Sat, 15 May 2004 11:21
Date: Sat, 15 May 2004 11:21
13 lines
1529 bytes
1529 bytes
Aquila wrote: > Waarom returnen functies rare dingen als ik ze oproep vanuit een andere > file, zonder de header te includeren? Het impliciete return-type voor functies die worden gebruikt voor ze worden gedeclareerd, is int (AFAIK). Als je dus iets anders als return-type hebt gespecifieerd, krijg je undefined behavior. Ik raad je aan om je compiler geen impliciete functie-declaraties te laten aanvaarden. -- Nicolas Barbier Protecting innovation against patent inflation <url:http://swpat.ffii.org/>
Re: C & headers
Author: Aquila
Date: Sat, 15 May 2004 12:13
Date: Sat, 15 May 2004 12:13
8 lines
1130 bytes
1130 bytes
Nicolas Barbier wrote: > Ik raad je aan om je compiler > geen impliciete functie-declaraties te laten aanvaarden. Ik had idd met -Wall moeten compileren, bedankt voor de uitleg! -- "May the source be with you"
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads