Go Down

Topic: Are Roll and Pitch keywords? (Read 269 times) previous topic - next topic

barryjo

In the following structure, in a basically very simple program,the variables Roll and Pitch are of a different color meaning I guess they are keywords. Is this correct? Why?

typedef struct {
  char Name[20] = "Hamil";
  int Thrust = 11;
  int Yaw = 22;
  int Roll = 12;
  int Pitch = 44;
  int Fmode = 19;
} Payload;

Delta_G

In the Arduino IDE when a word turns orange it just means that some library writer included that word in their keywords.txt file.  It doesn't mean that the word actually doe anything.  It certainly doesn't mean that it is reserved.  It doesn't even mean that it is in a library that you are using in your code, just that it is in some library on your computer. 

It's  a pretty useless thing the coloring on the Arduino IDE.  There are IDE's where the context sensitive coloring works and actually tells you something.  On Arduino the colors of words are meaningless. 
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

barryjo

In my case, the words Roll and Pitch are the same color as int, byte, and struct, a green color.
In my test,I am not including any libraries at all.

Thanks


Delta_G

In my case, the words Roll and Pitch are the same color as int, byte, and struct, a green color.
In my test,I am not including any libraries at all.

Thanks


It still doesn't tell you anything about how those words are used. They're certainly not reserved keywords.  You should be fine to use them however you want in your code. 
|| | ||| | || | ||  ~Woodstock

Please do not PM with technical questions or comments.  Keep Arduino stuff out on the boards where it belongs.

pert

In my case, the words Roll and Pitch are the same color as int, byte, and struct, a green color.
That just means that in the root folder of one of your installed libraries there is a file named keywords.txt that contains the following lines:
Code: [Select]
Roll LITERAL1
Pitch LITERAL1

In my test,I am not including any libraries at all.
As Delta_G said, the Arduino IDE just blindly colors all keywords for all installed libraries regardless of whether you are actually using that library in your sketch.

Go Up