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

Fix issue 23872 - Wrong example in Interfacing to C, calling printf #3594

Merged

Conversation

PetarKirov
Copy link
Member

@PetarKirov PetarKirov commented May 1, 2023

The key part of the printf syntax relating to this example is essentially: %{length modifier}{conversion format specifier}. Some common examples:

  • length modifiers:
    • (none) -> used for: int, usinging int
    • l -> used for: long, unsigned long
    • ll -> used for: long long, unsigned long long
    • z -> used for: size_t
    • t -> used for: ptrdiff_t
  • conversion specifiers:
    • d, i - signed integer integer to decimal representation
    • u - unsigned decimal integer to decimal representation
    • o - unsigned decimal integer to octal representation
    • x - unsigned decimal integer to hexadecimal representation

For reference, see: https://en.cppreference.com/w/c/io/fprintf

The issue was reported here:
https://forum.dlang.org/post/wodeaztcqwxulrfrgjvb@forum.dlang.org

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @PetarKirov!

Bugzilla references

Auto-close Bugzilla Severity Description
23872 minor Wrong example in Interfacing to C: Calling printf section

@PetarKirov PetarKirov force-pushed the fix/23872/interfacing-to-c-calling-printf branch from 84a46cc to 19fb817 Compare May 1, 2023 09:25
@RazvanN7 RazvanN7 merged commit f6a6d49 into dlang:master May 1, 2023
@PetarKirov PetarKirov deleted the fix/23872/interfacing-to-c-calling-printf branch May 1, 2023 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants