system
(system)
August 27, 2018, 8:28am
1
tbacarrot wrote on Monday, August 27, 2018 :
Hi guys,
In FreeRTOS intention standard, tab characters are used to indent. One tab equals four spaces.
I’d like to clarify whether
Tab witdh = 4 spaces and nothing else OR
Tab should be replaced/expanded by 4 spaces
Could you please tell me which one I should follow?
Thank you.
htibosch
(Hein Tibosch)
August 27, 2018, 8:45am
2
heinbali01 wrote on Monday, August 27, 2018 :
Here is a text example of tab size 4:
123 4 // contents: "123<tab>4"
12 34 // contents: "12<tab>34"
1 234
1234
There are no spaces in this text, just tabs.
In most editors, by default the tab size is 8:
123 4 // contents: "123<tab>4"
12 34
1 234
1234
A tab ( ASCII 9 ) is a single character that sets the character position to the nearest multiple of “tab size”.
The actual size depends on the editor settings, by default it is 8, but programmers like more compact text and use 4.
system
(system)
August 27, 2018, 8:54am
3
tbacarrot wrote on Monday, August 27, 2018 :
Hi Hein,
I notice that FreeRTOS kernel strictly uses tab only. But in many demo files, tabs are directly replaced by 4 space.
Thus I’m a little confused.
htibosch
(Hein Tibosch)
August 27, 2018, 9:22am
4
heinbali01 wrote on Monday, August 27, 2018 :
What kind of text editor are you using?
Can you give one example of a demo file? Where did it come from?
system
(system)
August 27, 2018, 9:56am
5
tbacarrot wrote on Monday, August 27, 2018 :
I check the code in multiple editors. In Source Insight and Notepad++, the tab and spaces are showed as what they originally are.
Take prvCheckTask()
in Demo\CORTEXSTEM32F103GCCRowley\main.c as an example. Tabs and spaces are mixed at the end of prvCheckTask (line 194 ~ line205)
htibosch
(Hein Tibosch)
August 27, 2018, 1:28pm
6
heinbali01 wrote on Monday, August 27, 2018 :
HI Ziji Hu, ah yes, in mentioned file main.c
there is a mix of tabs and spaces. If the coding standard is to be followed, the spaces should have been tabs.
In my Notepad++ I found this option: “Settings -> Preferences -> Language -> Tab size : 4”. I’m sure you have found it already.
system
(system)
August 28, 2018, 5:30am
7
tbacarrot wrote on Tuesday, August 28, 2018 :
Hi Hein, thanks a lot for the clarification