You are arguing "C cannot be an OO language because it lets you do X, and an OO language won't let you do X." My counterargument is "Smalltalk lets you do X, but everyone agrees that Smalltalk is an OO language; hence, you claim that if a language lets you do X it can't be an OO language must be false".
> So now I ask - to which of the so-called objects does F(const char, FILE, DIR) belong? The answer is whatever you want it to be, because they're only objects in your mind, and you can imagine that F belongs to FILE, or to const char, or to all of them, or FILE/DIR stop being objects, and so on.
If a language permits methods/functions which do not belong to any class, does that mean it can't be OO?
A class-less method/function is equivalent to a single-method utility class. A language can't be OO if it lets you create a utility class?
> Without syntax for objects (either explicit or implicit by convention), it's up to your imagination to decide what are the objects in your program.
Consider this C code:
// Declarations in counter.h
typedef struct {
void *privateData;
int (*getValue)(Counter*);
void (*increment)(Counter*);
void (*decrement)(Counter*);
void (*destroy)(Counter**);
} Counter;
Counter* newCounter();
// In main function:
Counter* counter = newCounter();
printf("Initial value: %d\n", counter->getValue(counter));
counter->increment(counter);
printf("After increment: %d\n", counter->getValue(counter));
counter->decrement(counter);
printf("After decrement: %d\n", counter->getValue(counter));
counter->destroy(&counter);
assert(counter == NULL);
In the above program, why isn't `counter` an object? Assumably "privateData" is just a pointer to an int, but for all you know, the Counter value is actually stored as EBCDIC Roman numerals.> My point is that if a language doesn't have a syntax for objects then it's not actually OO.
C in itself has no concept of an "object". But, there are certain conventions you can adopt in C code which make something an "object". My code above is one example of such a convention, there are others – for example, Microsoft COM (an object is a struct whose first member is a pointer to a struct of function pointers, and the remainder of the struct is private to the implementing class).