Page 7 of 7

Re: Mundane C tricks ...

Posted: Mon Dec 24, 2012 10:03 am
by taniwha
Ah, yes, memset and C++ objects is dangerous (more charred fingers). I learned to go very carefully though the list of fields in my constructors.

Re: Mundane C tricks ...

Posted: Mon Dec 24, 2012 11:15 am
by revelator
The code was allready there from stock ID source so might have been an oversight when they started porting stuff from C to C++ ;)
atleast its Things that teach you to be very carefull not to treat OO code the same as C hehe.
I learn a bit more every day and while most C operations are also valid in C++ there are a few differences like the
beforementioned example that one has to be aware of.

And merry Christmas all :)

Re: Mundane C tricks ...

Posted: Thu Dec 27, 2012 4:05 am
by Baker
I just discovered printf "%g". I swear I've read printf formatting docs a million times.

It is rather difficult to identify which version of C it became a standard, so maybe this format specifier didn't always exist or something.

%g prints a float, but without the superfluous zeros 1.000000000000000000000

/Strange that I had to clear cookies in browser to log-in to this site successfully. Without doing so, I got logged out immediately any time I tried in the last few days, and a crapton of PHP header "already included" stuff appears atop the page.

Re: Mundane C tricks ...

Posted: Thu Dec 27, 2012 12:17 pm
by taniwha
Yeah, %g is nice. QF has been using it for a while (especially in that builtin that goes to pains to strip trailing 0s). I've almost forgotten %f exists :).

Re: Mundane C tricks ...

Posted: Thu Dec 27, 2012 6:38 pm
by frag.machine
Baker wrote:/Strange that I had to clear cookies in browser to log-in to this site successfully. Without doing so, I got logged out immediately any time I tried in the last few days, and a crapton of PHP header "already included" stuff appears atop the page.
Yeah, got same problem here, I was thinking I3D hated my Opera mobile but since I am not the only one having a hard time to login maybe someone could check what's wrong.

Re: Mundane C tricks ...

Posted: Fri Dec 28, 2012 12:29 am
by Baker
frag.machine wrote:
Baker wrote:/Strange that I had to clear cookies in browser to log-in to this site successfully. Without doing so, I got logged out immediately any time I tried in the last few days, and a crapton of PHP header "already included" stuff appears atop the page.
Yeah, got same problem here, I was thinking I3D hated my Opera mobile but since I am not the only one having a hard time to login maybe someone could check what's wrong.
The skygods are testing us, to see if we are worthy. Zeus and his friends are having a laugh right now, at our expense ...

Re: Mundane C tricks ...

Posted: Sun Dec 30, 2012 2:03 pm
by revelator
Heh recently discovered %p for printing pointers, somewhat weird experience since earlier msvc newer bitched about using any of the other print types but msvc2012 seems to have taken a new approach (%p also Works in msvc2010 but i havent tried in earlier versions yet).

Kinda hope clang catches up and will be supported by C::B its error checking is a revelation compared to gcc's but speedwise it still lacks some compared and it has no own standard library yet that im aware of so it uses gcc's.

Re: Mundane C tricks ...

Posted: Sun Dec 30, 2012 6:46 pm
by Baker
reckless wrote:Heh recently discovered %p for printing pointers
I've had better luck at locating good printf tricks in recent times like printf ("%-20.20s", fixed_length_printing_string);

Or %x, even %c