openFrameworks icon indicating copy to clipboard operation
openFrameworks copied to clipboard

[W.I.P.] suppress warning about implicit type conversions

Open 2bbb opened this issue 2 years ago • 4 comments

related: #6929

2bbb avatar Apr 06 '22 09:04 2bbb

@dimitre

I try to supress warnings, but I can't decide what is correct way in many situations. I think, rest of warnings are from gaps between C++ types and OpenGL (or other third-party library) types.

Maybe, we have to do force cast, but is it fundamental solution...?

for example, ofTexture::allocate:

  • many ofTexture::allocate methods delegating to other allocate method with size_t arguments like allocate(pix.getWidth(), pix.getHeight(), ...)
  • but width and height arguments of ofTexture::allocate is typed as int
  • and allocate method that is finally called, w and h will assinged to texData.width, texData.height are typed as float

I can't decide what is right type to allocate.

what do you think...?

2bbb avatar Apr 06 '22 10:04 2bbb

I suppose texData is float for a reason, like the tex hack to remove artifacts, so maybe ofTexture allocate should use float parameters? What do you think @ofTheo ?

dimitre avatar Apr 06 '22 16:04 dimitre

What is the problem with implicit conversion other than the annoying warnings?

roymacdonald avatar Apr 08 '22 22:04 roymacdonald

@roymacdonald I think the warnings are there so we can make decision about control of the types. This specific one already brings the question : should a texture be allocated with float? if yes should ofTexture receive float parameters too ?

dimitre avatar Apr 08 '22 22:04 dimitre