1

I wrote a function that takes characters and noticed that the Arduino Compiler treated some characters like system-reserved, and other like functions, and a few just like characters. Lowercase doesn't seem to be effected. I'm just wondering why. enter image description here

5
  • 1
    What is your code supposed to mean? Nov 18, 2016 at 19:07
  • 4
    Are you referring to the different colors of the letters? The syntax highlighter is made to highlight correct C code. Giving it invalid code will produce invalid highlighting. I wouldn't try to read too much into it.
    – Gerben
    Nov 18, 2016 at 19:10
  • Oh ok. I may have read into it too much
    – j0h
    Nov 18, 2016 at 23:33
  • @EdgarBonet its a segment, you give it forward(a||b) and motor a or b moves forward, or reverse, or brakes, or halts all, etc. It also was working(need more testing) I was just curious about the syntax highlighting which I noticed while I was writing it.
    – j0h
    Nov 18, 2016 at 23:38
  • Please copy and paste your code, not a picture of it. For help see Markdown help. You can format code by selecting the code and pressing Ctrl+K to have your browser do this for you.
    – Nick Gammon
    Nov 19, 2016 at 6:42

2 Answers 2

2

The Arduino IDE does keyword coloration according to a very crude system. It simply scans for all the keywords.txt files included with:

  • Arduino IDE
  • Libraries bundled with the Arduino IDE
  • Libraries you have installed to the libraries subfolder of your sketchbook
  • Libraries bundled with the hardware package of the currently selected board - Hardware package of the currently selected board (recent IDE versions only)

There are several types of keyword identifiers that determine which color is used. The reason those letters are colored in your IDE is because some library you have installed just happens to have added them to its keywords.txt file. The Arduino IDE makes no attempt to determine whether you have included those libraries and so coloration doesn't necessarily mean they are "reserved". If you have not included the library that defines a specific keyword then the coloration of that keyword is meaningless.

For more information on keywords.txt see:
https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#keywords

1

In WString.h is a define:

#define F(string_literal) (reinterpret_cast<const __FlashStringHelper *>(PSTR(string_literal)))

In other words, the letter F is already a macro.

I don't know what your code:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

is supposed to do. I suppose you are just testing the syntax highlighting?

The syntax highlighting is designed to try to "help" you by colouring words in a pre-supplied file in a different way. It doesn't in any way affect how the compilation works. And, judging by what you posted, it can't always be relied upon. Personally, I ignore it.

1
  • I was just showing the letters that do syntax highlighting.
    – j0h
    Nov 19, 2016 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.