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

Codegen for nullable structs in friendly overloads could be optimized #277

Closed
jnm2 opened this issue May 31, 2021 · 0 comments · Fixed by #848
Closed

Codegen for nullable structs in friendly overloads could be optimized #277

jnm2 opened this issue May 31, 2021 · 0 comments · Fixed by #848
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@jnm2
Copy link
Contributor

jnm2 commented May 31, 2021

Example from CredUIPromptForWindowsCredentials:

CREDUI_INFOW pUiInfoLocal = pUiInfo.HasValue ? pUiInfo.Value : default(CREDUI_INFOW);
uint __result = PInvoke.CredUIPromptForWindowsCredentials(pUiInfo.HasValue ? &pUiInfoLocal : null, ...);

pUiInfo.HasValue ? pUiInfo.Value : default(CREDUI_INFOW); could be replaced with pUiInfo ?? default which is more idiomatic C# and which compiles to pUiInfo.GetValueOrDefault() which IIRC is jitted as direct field access. Whereas calling .Value adds an additional redundant check and looks more complex.

(Version used: 0.1.422-beta)

@jnm2 jnm2 added the enhancement New feature or request label May 31, 2021
@AArnott AArnott added good first issue Good for newcomers help wanted Extra attention is needed labels Jun 11, 2021
AArnott pushed a commit that referenced this issue Sep 9, 2024
Bumps [powershell](https://github.com/PowerShell/PowerShell) from 7.4.3 to 7.4.4.
- [Release notes](https://github.com/PowerShell/PowerShell/releases)
- [Commits](PowerShell/PowerShell@v7.4.3...v7.4.4)

---
updated-dependencies:
- dependency-name: powershell
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants