>Now in regards to C++ and specifically the API, there are a number of functions that return a BOOL (Boolean) data type. Like VB, logical false will be equal to zero. Unlike, VB (and the result of performing a bitwise NOT on 0), these functions return 1 rather than -1. I'm just wondering if anyone knows why.
>
The BOOL operator really works at the bit-level, but without masking the result, it returns at least a byte, in VFP, a value of byte size or larger is the limit of visibility. BOOL operates on the assumption that any visible non-zero result is TRUE - if you need to mask a bit, you AND the result.
>My curiousity got piqued when I recently upsized a table to SQL server. In that environment, Boolean fields are stored as a bit. Naturally, -1 isn't really possible there, since you'd need at least a second bit to determine the sign. However, I sincerely doubt that C++ would do something similar since the smallest portion of addressable memory is a byte, and breaking a byte down into 8 individual BOOLs seems rather silly, not to mention the overhead difficulties that would be created.
>
That not really true - there are LOTS of structs that use individual bits to designate boolean condition (oy - just try digging around inside a PIF some time) and the cost of a logical AND operator is very small in C.
You make some bad assumptions - many of the C structures are designated as machine-dependent; a ULONG and a DWORD are not necessarily the same if you move out of the Win32 platform.