Convert int64_t to double

前端 未结 4 1726
野趣味
野趣味 2021-02-07 05:31
  int64_t a = 1234;

  double d = (double) a;

Is this the recommended way?

4条回答
  •  遥遥无期
    2021-02-07 06:10

    For POD types both versions do the same thing. Choose the one you prefer and be consistent.

    I know many people who prefer the former for typing/readability and I tend to agree with this but I can live with either.

    I've heard the "easy to grep for" argument many times but have yet to ever come across a situation where I've needed to grep my codebase for POD casts.

提交回复
热议问题