Skip to content

Add cpp2::to_string(char const&) overload #194

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

Merged

Conversation

filipsajdak
Copy link
Contributor

In the current implementation, cpp2::to_string will treat the char variable as an integral type and will print the integer value of char instead of the character.

main: () -> int = {
    c : char = 36;
    std::cout << "c = '(c)$'" << std::endl; // prints: c = '36'
}

after this change, it will print the character

main: () -> int = {
    c : char = 36;
    std::cout << "c = '(c)$'" << std::endl; // prints: c = '$'
}

@hsutter
Copy link
Owner

hsutter commented Jan 6, 2023

Looks good, thanks!

@hsutter hsutter merged commit 0d7504c into hsutter:main Jan 6, 2023
@filipsajdak filipsajdak deleted the fsajdak-add-to_string-overload-for-char branch January 6, 2023 01:54
Azmah-Bad pushed a commit to Azmah-Bad/cppfront that referenced this pull request Feb 24, 2023
…-overload-for-char

Add cpp2::to_string(char const&) overload
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.

2 participants