Skip to content

Minor change to asserts, fix compiler warnings.#11

Open
codecop wants to merge 2 commits into
c-koans:masterfrom
codecop:master
Open

Minor change to asserts, fix compiler warnings.#11
codecop wants to merge 2 commits into
c-koans:masterfrom
codecop:master

Conversation

@codecop
Copy link
Copy Markdown
Contributor

@codecop codecop commented Apr 21, 2020

Hi, final PR with last changes/fixes I found in the koans. Thank you for C Koans.

Copy link
Copy Markdown
Contributor

@brian-gavin brian-gavin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good after resolving the printing feedback

Comment thread src/about_printing.c
cr_assert_file_contents_eq_str(stdout,
"char: J\nint: -1\nunsigned int: 4294967295\nhexadecimal unsigned int: "
"ffffffff\nfloat: 3.140000\nlong: 3735928559\npointer: 0x400\n");
"ffffffff\nfloat: 3.140000\nlong: 3735928559\npointer: 00000400\n");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the intended solution of using the %p format specifier to print p, this solution should be 0x400.

If you experienced some other behavior, let me know

Copy link
Copy Markdown
Contributor Author

@codecop codecop Apr 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using Windows 7 x64, GCC from MingW
with %p GCC version 4.5.2 x86 gave me 00000400
with %p GCC version 4.7.2 x64 gave me 0000000000000400

I am compiling against -std=c99 - maybe that is the cause?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking into some MingW tickets/issues related to printf and this one seems promising, thought I haven't had the chance to parse through everything yet.

https://sourceforge.net/p/mingw/bugs/1173/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you want to proceed? I can remove the change of address 0x400 in the PR if you want me to

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