Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
what's differences each C ?
I think it should be made a crime, punishable by death, to have the same name (distinguishable only by case) used for two different purposes.Had Microchips C18 stuck with the convention of constants in upper case and variables in lower case then porting would have been much easier. It makes sense to me that PORTA is the address of the port and porta is the value stored at location PORTA. What do others think?
Mike.
constants in upper case and variables in lower case
I think it should be made a crime, punishable by death, to have the same name (distinguishable only by case) used for two different purposes.
This is just begging for confusion and bug-ridden code.
What is wrong with, say, a constant called PORTA_ADDRESS and a variable PORTA_value? Look how clear the distinction is - in any case. Not that you normally need either....
The definition of PORTA, usually contained in a .h file, seems to be written cleverly enough to translate our use of "PORTA" into the correct compiler-dependant C definition that gives the effect that we want.
LPCXpresso IDE (powered by Code Red)
As far as I know, Microchip does tend to use Upper Case for constants, and lower case (EDIT or mixed case) for variables. Perhaps you could give an example where they do not?Mike I think it would be a good idea too it's a hell of a lot easier to see what your pointing to.
Hex I think you looking at what Mike is saying wrong He talking about
I have no problem with the convention of using uppercase for constants, which I believe is a C convention, not just a Micrchip one. I also think it is an excellent idea.You seem to be confused about the word "convention".
Mike.