Skip to content

C Style Guide: no whitespace after a type cast #1137

@Totktonada

Description

@Totktonada

Cited from https://lists.tarantool.org/pipermail/tarantool-patches/2020-February/014403.html:

Nit: We usually split a cast operator from its argument with a
whitespace, e.g. (ssize_t) inj->iparam.

No we don't, there are number of examples where we put cast
right before operand and I think it is a way more correct
because code reader should consider such cast as signle entry
together with operator itself. So I prefer this style.

You're right.

  1. man 1 indent shows -ncs (--no-space-after-casts) in the Linux style
    description.
  2. It is also copy-pasted to 1 without -npsl
    (--dont-break-procedure-type).
  3. Vladimir D. uses it in this way in vinyl code.
  4. The type cast operation has the same priority as other unary
    operations.

Don't know why I was sure that a space should be here.

(I think we need to review it with other developers, so consider now just as a stub issue: it is filed to don't forget to file it.)

Metadata

Metadata

Assignees

Labels

add details[nature] More details needed, some info missing. Documentation is incomplete.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions