1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
bf(C++) uses very strict i(type checking). A prototype must be known for each
function before it is called, and the call must match the prototype.
The program
verb( int main()
{
printf("Hello World\n");
})
often compiles under bf(C), albeit with a warning that hi(printf)tt(printf())
is an unknown function. But bf(C++) compilers (should) fail to produce code in
such cases. The error is of course caused by the missing hi(stdio.h)
tt(#include <stdio.h>) (which in bf(C++) is more commonly included as
hi(cstdio) tt(#include <cstdio>) directive).
And while we're at it: as we've seen in bf(C++) ti(main) em(always) uses
the tt(int) i(return value). Although it is possible to define hi(main)tt(int
main()) without explicitly defining a return statement, within tt(main) it is
not possible to use a tt(return) statement without an explicit
tt(int)-expression. For example:
verb( int main()
{
return; // won't compile: expects int expression, e.g.
// return 1;
})
Implicit conversions from tt(void *) to non-void pointers are not
allowed. E.g., the following isn't accepted in bf(C++):
verb( void *none()
{
return 0;
}
int main()
{
int *empty = none();
})
|