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

Minor change to asserts, fix compiler warnings. #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

codecop
Copy link
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
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

printf("hexadecimal unsigned int: TODO\n", i);
printf("float: TODO\n", d);
printf("long: TODO\n", l);
printf("pointer: TODO\n", p);
#endif
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
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
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
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
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