dbry / WavPack

WavPack encode/decode library, command-line programs, and several plugins
BSD 3-Clause "New" or "Revised" License
363 stars 66 forks source link

eliminate use of '&' address-of operator on arrays: #130

Closed sezero closed 1 year ago

sezero commented 1 year ago

fixes warnings from WatcomC (Open Watcom):

extra1.c(237): Warning! W115: &array may not produce intended result
extra1.c(556): Warning! W115: &array may not produce intended result
extra1.c(611): Warning! W115: &array may not produce intended result
extra2.c(396): Warning! W115: &array may not produce intended result
extra2.c(650): Warning! W115: &array may not produce intended result
extra2.c(746): Warning! W115: &array may not produce intended result
extra2.c(818): Warning! W115: &array may not produce intended result
tag_utils.c(529): Warning! W115: &array may not produce intended result
dbry commented 1 year ago

Thanks for this! If you agree with my suggestion and update the PR, I'll bring it in.

sezero commented 1 year ago

I'd update the PR, but what is the suggestion?

dbry commented 1 year ago

I'd update the PR, but what is the suggestion?

For the src/pack_utils.c change I think it would be better to change the char zero [1] = { 0 }; to just char zero = 0; and leave the reference to it unchanged (i.e., &zero). It doesn't need to be an array at all. Doesn't that make more sense?

sezero commented 1 year ago

For the src/pack_utils.c change I think it would be better to change the char zero [1] = { 0 }; to just char zero = 0; and leave the reference to it unchanged (i.e., &zero). It doesn't need to be an array at all. Doesn't that make more sense?

Indeed. Updated and force-pushed the patch.

sezero commented 1 year ago

If you are interested in watcom compiler support, I have initial support in my branch at https://github.com/sezero/WavPack/tree/watcom-0 (library only, no client.)