0

I installed visual studio 2017 professional and I have indent problem.

when I'm typing

void function(0, 0,
              1, 2);

and it's ok, but when I'm typing additional ( symbol I have this indent problem

void function(0, 0,
     (float)1, 2);

I changed setting inside Tools->Options->Text Editor->C/C++->Formatting->Indentation but can't get same indentation with additional '(' symbol.

Alatriste
  • 527
  • 2
  • 6
  • 21

1 Answers1

1

Old style C cast should not be used in c++ code (there are better alternatives available for casting). But in this case, you can just use literal float instead: (And you will killing two problems at one time)

void function(0, 0,
              1.f, 2);
Rama
  • 3,222
  • 2
  • 11
  • 26
  • Thank you for answer, So there is no way to use old C cast type without that indent problem right? :( – Alatriste Mar 14 '18 at 19:06
  • @FrançoisAndrieux, thanks for clarification, edited! – Rama Mar 14 '18 at 19:11
  • @Alatriste, honestly I'm not sure, I'm just giving you a workaround. – Rama Mar 14 '18 at 19:13
  • @Alatriste, maybe this helps you: https://stackoverflow.com/questions/15578935/proper-way-of-casting-pointer-types And: https://embeddedartistry.com/blog/2017/2/28/c-casting-or-oh-no-we-broke-malloc – Rama Mar 14 '18 at 19:30
  • 1
    This isn't true. You can absolutely use C-style casts in C++, it's just not a good idea because there are better alternatives available. – Cubic Mar 14 '18 at 23:01