![]() |
|
A Question About C - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: C, C++, & Obj-C (https://sinister.ly/Forum-C-C-Obj-C) +--- Thread: A Question About C (/Thread-A-Question-About-C) Pages:
1
2
|
RE: A Question About C - 0xDEAD10CC - 10-18-2015 (10-18-2015, 05:04 AM)CPU Wrote: My C compiler makes a function's return type default to "int", and I'll always be using that compiler, but you do somewhat have a point. This doesn't mean that others will be using other compilers to port your code to another platform if you ever write open source code, nor does it mean that your compiler will always do this for you and not comply with the ISO C standard until the end of time. My point is 100% valid. ![]() There are more than just a single reason why it is a warning. RE: A Question About C - CPU - 10-18-2015 (10-18-2015, 05:10 AM)0xDEAD10CC Wrote: This doesn't mean that others will be using other compilers to port your code to another platform if you ever write open source code, nor does it mean that your compiler will always do this for you and not comply with the ISO C standard until the end of time. My point is 100% valid. Thank-you. Your reply really helped me, and I will be explicitly declaring my function return types to be "int" instead of no specified return type. However, I have been reading online about "void" inside of parentheses vs. an empty parameter list, and still don't really get it. What are all of the differences between having "void" inside the function parentheses and having a blank parameters list? Also, is the effect different for both function declarations and definitions? Thanks. RE: A Question About C - 0xDEAD10CC - 10-18-2015 Quote:What are all of the differences between having "void" inside the function parentheses and having a blank parameters list? I already specified the only difference it makes in my first post. 0.o This is valid: Code: void f()
{
}
int main(void)
{
f(3);
return 0;
}This won't compile: Code: void f(void)
{
}
int main(void)
{
f(3);
return 0;
}
|