Opened 7 years ago

Closed 7 years ago

#1377 closed enhancement (wontfix)

strange code

Reported by: kolya Owned by:
Priority: trivial Milestone:
Component: HM Version: HM-16.3
Keywords: Cc: ksuehring, davidf, karlsharman, jct-vc@…

Description

In TAppDecTop.cpp line 126 there is

while (!!bitstreamFile)

Is double "!!" really better than while (bitstreamFile) ?

Change History (3)

comment:1 Changed 7 years ago by DefaultCC Plugin

  • Cc ksuehring davidf karlsharman jct-vc@… added

comment:2 Changed 7 years ago by dthoang

The ! operator is used twice in this context to convert the type of bitstreamFile to bool. It is shorter than (bitstreamFile != 0), which has type bool. The type of bistreamFile by itself is not bool. It depends on how strict you are as a programmer and how strict the compiler is. I consider it good coding practice.

comment:3 Changed 7 years ago by ksuehring

  • Resolution set to wontfix
  • Status changed from new to closed

I made a quick test with clang and it generates exactly the same assembler code for implicit conversion as for the double negation.

I guess, it's fine as it it, but I don't have strong feelings...

Closing as won't fix. Feel free to reopen, if you think we should change it.

Note: See TracTickets for help on using tickets.

This list contains all users that will be notified about changes made to this ticket.

These roles will be notified: Reporter, Owner, Subscriber, Participant

  • David Flynn(Subscriber)
  • Dzung Hoang(Participant)
  • jct-vc@…(Subscriber)
  • Karl Sharman(Subscriber)
  • karl.sharman@…(Always)
  • Karsten Suehring(Subscriber, Participant, Always)
  • Nikolay Shlyakhov(Reporter)