Mundane C tricks ...
Re: Mundane C tricks ...
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.
Leave others their otherness.
http://quakeforge.net/
http://quakeforge.net/
Re: Mundane C tricks ...
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
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
Productivity is a state of mind.
Re: Mundane C tricks ...
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.
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.
The night is young. How else can I annoy the world before sunsrise? Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
Re: Mundane C tricks ...
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 .
Leave others their otherness.
http://quakeforge.net/
http://quakeforge.net/
-
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
Re: Mundane C tricks ...
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.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.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC (LordHavoc)
Re: Mundane C tricks ...
The skygods are testing us, to see if we are worthy. Zeus and his friends are having a laugh right now, at our expense ...frag.machine wrote: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.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.
The night is young. How else can I annoy the world before sunsrise? Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
Re: Mundane C tricks ...
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.
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.
Productivity is a state of mind.
Re: Mundane C tricks ...
I've had better luck at locating good printf tricks in recent times like printf ("%-20.20s", fixed_length_printing_string);reckless wrote:Heh recently discovered %p for printing pointers
Or %x, even %c
The night is young. How else can I annoy the world before sunsrise? Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..