The oct converter handles the %o conversion.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
| libc/src/stdio/printf_core/oct_converter.h | ||
|---|---|---|
| 27 | static is not needed here. | |
| 38 | Optional: technically you can use buffer[--buff_cur] = ... and remove the --buff_cur in the line above. But I'm not sure if it makes this less readable. | |
| 91 | Look like you don't need to reset spaces and zeros to 0 when they are negatives here and above, since you already check to make sure they are positive before using in the if-else's below. | |
address comments
| libc/src/stdio/printf_core/oct_converter.h | ||
|---|---|---|
| 38 | In this case, I'd say keeping them separate makes it more clear that we're writing to buff_cur - 1 and not bufcur, so I'm going to leave it. | |
| 91 | spaces doesn't need to be reset, but zeroes does when it's being used in later calculations (see lines 73-76). | |
| libc/src/stdio/printf_core/oct_converter.h | ||
|---|---|---|
| 33–34 | Nitty nit: ISTM like this sentence is written in the oppositte way. You probably want: Since the buffer is size to sized to be able fit the entire number, buf_cur can never reach 0. So, we do not need bounds checking on buf_cur. | |
| 40 | Nit: The name digits_written can be confusing in the presence of a writer. You probably want to name it digits_in_val, or just num_digits. | |
| 42 | Nit: Please follow the convention of starting comments with upper case first letters. Here and elsewhere. | |
| 93 | Are writes guaranteed to succeed? | |
static is not needed here.