Timeline for Primitive String trimmer in C
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 22, 2017 at 5:16 | comment | added | chux |
Use if (isspace((unsigned char) input[i]) { to avoid potential UB of this comment
|
|
Apr 22, 2017 at 3:46 | comment | added | Mark |
Using the single letters i , j , and k when iterating through arrays is very much idiomatic C. It's only when you're getting into fancier operations (eg. a circular buffer) that you should name your indices.
|
|
Apr 21, 2017 at 19:17 | comment | added | Roland Illig |
isspace invokes undefined behavior when invoked with a negative char value other than EOF , and that can happen quickly with UTF-8 encoded text on x86 machines.
|
|
Apr 21, 2017 at 19:09 | comment | added | jamesqf | Lots of wrong things here. For one, using single letters i,j,k &c for simple array indicies is absolutely the most meaningful and (for an experienced programmer) easiest to comprehend. Excessively verbose and not meaningful names like "inputCharacterP" hinder comprehension. Likewise, it's no more difficult to find the variable names if they're on the same line, and easier to read and see that they're related. | |
Apr 21, 2017 at 14:34 | comment | added | Eman Yalpsid |
isspace returns "true" on all kinds of white-space, not just ' '.
|
|
Apr 21, 2017 at 14:25 | comment | added | pacmaninbw♦ | @geostocker Not at the level of C programming you're currently at. The biggest problem I see is the readability. | |
Apr 21, 2017 at 14:20 | comment | added | geostocker | Cheers, mate. Seems like it's mostly syntactical issues. I'd definitely be expanding it to decompress files etc. Problem is that I'm compiling and executing on CygWin atm, so I'm not too keen on having to redo things when I'm at home on my ubuntu laptop due to differentiating EOFs etc. Any other things that you think were standing out to you? | |
Apr 21, 2017 at 14:13 | history | answered | pacmaninbw♦ | CC BY-SA 3.0 |