A question about tab in coding standard

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.

A question about tab in coding standard

Here is a text example of tab size 4: ~~~ 123 4 // contents: “1234″ 12 34 // contents: “1234″ 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: “1234″ 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.

A question about tab in coding standard

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.

A question about tab in coding standard

What kind of text editor are you using? Can you give one example of a demo file? Where did it come from?

A question about tab in coding standard

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 DemoCORTEXSTEM32F103GCCRowleymain.c as an example. Tabs and spaces are mixed at the end of prvCheckTask (line 194 ~ line205)

A question about tab in coding standard

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.

A question about tab in coding standard

Hi Hein, thanks a lot for the clarification