Comments (9)
Sorry but Github is a new tool for me. I am still learning how it works.
Could you please help me on this "white space" issue ?
from arduino_stm32.
Different code editors use different methods to indent. Some use spaces, some use tabs and some use custom tab widths. If we all use different tab widths and spacing for indenting then the code looks very strange when people make changes.
If we document how white space (\r\n, \n, \b , \t ) are used then it will be easier to have code that looks the same for everyone.
The Arduino IDE uses 2 for the tab width. However, typically people writing the libraries don't. I don't even know what this code is supposed to be. That is why I'm asking. [Edit] I just looked and the Arduino 1.6.5 * what i'm using * inserts spaces even if i use tabs.[/edit]
from arduino_stm32.
I use Notepad++ as it is my favorite text editor.
I setup the Notepad to use 2 white spaces for every depth change (for {...})
Moreover, I choose to convert any Tab into 2 white spaces.
from arduino_stm32.
Most of the maple code I've looked at is setup with tabs set to 4 or the code is using 4 spaces.
[Edit] I just looked and it seems like most of it is 4 spaces no tabs [/Edit]
from arduino_stm32.
Vasillis
I use Notepad++ as well.
I noticed that lots of code has different spacings, but as AFIK, white space doesn't effect the function of a C program. I'm not sure how this is technical issue. (unlike some other languages)
Please correct me if I'm wrong
from arduino_stm32.
It isn't a technical issue. .. I guess it is fine.
from arduino_stm32.
I guess anything goes.
from arduino_stm32.
I'm thinking this kind of stuff should have a section in the forums called:
"Coding standards"
Some guidelines, if you don't follow them nothing breaks, if you follow them is easier to read, so I think is a subject for the forum.
from arduino_stm32.
This is loosely coding standards, but wasn't rick's issue that the file has strange tab settings.
I suspect that the tab settings may not even have been defined by Vasillis, but as the library was ported I suspect that the tab settings may well have come from the original author of the library.
Its asking a bit much of anyone porting a library, that they reformat all the code.
In terms of coding standards, I'd be more inclined to be concerned about things like this
while (len)
{
uint16_t addr = pgm_read_word(buf++); len--;
uint16_t n = pgm_read_word(buf++); len--;
Which appear to be in the original library
https://github.com/maniacbug/VS1053/blob/master/VS1053.cpp
(a) Why are addr and n both defined inside a while loop ???
(b) Why is len--; not on its own line ?
(c) Why is len being decremented twice when the second line doesn't use len e.g.
uint16_t n = pgm_read_word(buf++);
doesn't use len, do why bother decrementing it after setting up addr
However I think our time is better spent fixing issues and porting other libraries etc, rather than nit picking though existing libraries that work OK.
After all, the whole Arduino and Open Source ethos is that anyone can write a library and publish it.
If code formatting is really such an issue, please feel to run lint on the code, however also please be sure to test your reformatted code on the hardware it supports, just on the offchance that somehow the reformatting went wrong.
from arduino_stm32.
Related Issues (20)
- USB Serial echos characters into the input (i.e. keyboard) HOT 15
- Support for Arduino IDE 2.х HOT 7
- PIN_MAP and boardPWMpins tables mismatch HOT 1
- Arduino IDE "Access Denied" on Uploading Sketch HOT 3
- Can't connect to target after flashing generic_boot20_pc13.bin using j-flash HOT 1
- Software reset HOT 1
- How to change default 42/72/128 MHz to 8/16Mhz HOT 2
- Add CH32F103 HOT 2
- Compilation error Problem with sketch that used library Arduino_STM32 HOT 1
- dfu upload failed on macOS + PlatformIO because cannot reset upload port HOT 5
- Writing String to EEPROM HOT 3
- EEPROM donot work on STM32F103C6(32k)
- ‘MCU basic current’ increases after PWM operation. help me. HOT 25
- Wire.h and Wire slave.h using in same program not working HOT 2
- Is 'STM32F103C8' 'digitalWrite' and 'digitalRead' possible in FAST mode? HOT 10
- Is any type a persistent storage available for STM32F4 ?
- Solution to use PB3 for things other than JTAG (Proposal for documentation note) HOT 2
- Not able to uploaded the code for NUCLEO-F103R HOT 2
- change clock soure HOT 5
- Unable to upload program when using STM32duino BootLoader HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arduino_stm32.