Hi, i'm using Keil Evaluation Boards to program my STM32F4Discovery. I was wondering, why can't I use boolean or bit type data? Or it's because i'm using the Evaluation version? I want to use "true" or "false" value, maybe i can use another type data besides that two buddies? I'll be happy and glad if anybody can help me with this one. Sorry for my bad english...
"IMO, a bool & bit should occupy same amount of memory."
Except for the tiny little fact that the C language doesn't have any 1-bit data type, and the same is true for most microprocessors. The bit field construct is just a grammatical work-around to hide a lot of AND/OR machine code instructions, so while it may save RAM space, it still consumes way more code space than what is needed by a 8051 processor that can actually read and write individual bits.
it still consumes way more code space than what is needed by a 8051 processor i totally agree. either save code at the cost of ram or vice-versa.
but some (over)smart people dont realize the fact that 7bits should not be wasted for what can be done in 1bit.
i have come across situations where people have written code using a lot of ram (unnecessarily) and then have altered a lot of code or written a lot of extra code just to create more space in ram. imho, precaution is better than cure.