Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce implicit cast compilation warnings #993

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jeroenbakker-atmind
Copy link
Contributor

@jeroenbakker-atmind jeroenbakker-atmind commented Mar 20, 2024

Description

Replacing implicit casts with static casts.
This PR doesn't do any functional or code flow changes, only making casts explicit.

/Users/jeroen/vulkan-git/Vulkan-Samples/samples/extensions/dynamic_line_rasterization/dynamic_line_rasterization.cpp:117:53: warning: implicit conversion loses integer precision: 'unsigned long' to 'uint32_t' (aka 'unsigned int') [-Wshorten-64-to-32]
        uint32_t vertex_buffer_size      = vertices.size() * sizeof(glm::vec3);
                 ~~~~~~~~~~~~~~~~~~        ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
/Users/jeroen/vulkan-git/Vulkan-Samples/samples/extensions/dynamic_line_rasterization/dynamic_line_rasterization.cpp:118:57: warning: implicit conversion loses integer precision: 'unsigned long' to 'uint32_t' (aka 'unsigned int') [-Wshorten-64-to-32]
        uint32_t cube_index_buffer_size  = cube_indices.size() * sizeof(uint32_t);
                 ~~~~~~~~~~~~~~~~~~~~~~    ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/Users/jeroen/vulkan-git/Vulkan-Samples/samples/extensions/dynamic_line_rasterization/dynamic_line_rasterization.cpp:119:58: warning: implicit conversion loses integer precision: 'unsigned long' to 'uint32_t' (aka 'unsigned int') [-Wshorten-64-to-32]
        uint32_t edges_index_buffer_size = edges_indices.size() * sizeof(uint32_t);
                 ~~~~~~~~~~~~~~~~~~~~~~~   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
3 warnings generated.

General Checklist:

Please ensure the following points are checked:

  • My code follows the coding style
  • I have reviewed file licenses
  • I have commented any added functions (in line with Doxygen)
  • I have commented any code that could be hard to understand
  • My changes do not add any new compiler warnings
  • My changes do not add any new validation layer errors or warnings
  • I have used existing framework/helper functions where possible
  • My changes do not add any regressions
  • I have tested every sample to ensure everything runs correctly
  • This PR describes the scope and expected impact of the changes I am making

Note: The Samples CI runs a number of checks including:

  • I have updated the header Copyright to reflect the current year (CI build will fail if Copyright is out of date)
  • My changes build on Windows, Linux, macOS and Android. Otherwise I have documented any exceptions

@CLAassistant
Copy link

CLAassistant commented Mar 20, 2024

CLA assistant check
All committers have signed the CLA.

@jeroenbakker-atmind jeroenbakker-atmind marked this pull request as draft March 20, 2024 10:06
asuessenbach
asuessenbach previously approved these changes Mar 20, 2024
@jeroenbakker-atmind jeroenbakker-atmind force-pushed the dynamic_line_rasterization/fix-xcode-build-warnings branch from a12a7d5 to 93a8a8a Compare March 21, 2024 17:53
@jeroenbakker-atmind
Copy link
Contributor Author

I had to force push as the CLA didn't like using not default email address in commit.
Note this is still a draft as there are other similar warnings in other areas I wanted to look into.

@jeroenbakker-atmind jeroenbakker-atmind changed the title Fix compilation warning deteced on XCode WIP: Fix compilation warning deteced on XCode Apr 8, 2024
@jeroenbakker-atmind jeroenbakker-atmind changed the title WIP: Fix compilation warning deteced on XCode WIP: Fix compilation warning detected on XCode Apr 8, 2024
@jeroenbakker-atmind jeroenbakker-atmind force-pushed the dynamic_line_rasterization/fix-xcode-build-warnings branch from 93a8a8a to 986d8fb Compare May 15, 2024 07:50
@jeroenbakker-atmind jeroenbakker-atmind changed the title WIP: Fix compilation warning detected on XCode Reduce compilation warning (implicit casts) May 15, 2024
@jeroenbakker-atmind jeroenbakker-atmind changed the title Reduce compilation warning (implicit casts) Reduce implicit cast compilation warnings May 15, 2024
@jeroenbakker-atmind jeroenbakker-atmind marked this pull request as ready for review May 15, 2024 08:08
@SaschaWillems SaschaWillems self-requested a review May 19, 2024 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants