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

cc: fix returning type of sel_types #3181

Merged
merged 3 commits into from
Jan 27, 2024

Commits on Jan 26, 2024

  1. cc: fix returning type of sel_types

    Fix the following compiler warning:
    ```
    /home/runner/work/deepmd-kit/deepmd-kit/source/api_c/src/c_api.cc:1336:17: warning: returning address of local temporary object [-Wreturn-stack-address]
      return (int*)&(dcm->dcm.sel_types())[0];
                    ^~~~~~~~~~~~~~~~~~~~~~
    1 warning generated.
    ```
    
    by returning the reference of sel_type.
    
    It seems this function is not used anywhere, even in the test, so we don't have an chance to find out if there is possible segfault. (so this warning has no impact)
    
    It seems DeepTensor has returned a reference since the beginning (deepmodeling#137). (perhaps because DeepTensor.sel_types is actually used) DeepTensor and DataChargeModifier have different returned types.
    njzjz committed Jan 26, 2024
    Configuration menu
    Copy the full SHA
    4071df9 View commit details
    Browse the repository at this point in the history
  2. fix compile error

    njzjz committed Jan 26, 2024
    Configuration menu
    Copy the full SHA
    8c8aeee View commit details
    Browse the repository at this point in the history
  3. add const

    njzjz committed Jan 26, 2024
    Configuration menu
    Copy the full SHA
    7cd3a2a View commit details
    Browse the repository at this point in the history