topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 7:31 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Deep C Fishing  (Read 6842 times)

Jibz

  • Developer
  • Joined in 2005
  • ***
  • Posts: 1,187
    • View Profile
    • Donate to Member
Deep C Fishing
« on: October 10, 2011, 09:07 AM »
http://www.slideshar...et/olvemaudal/deep-c

Some excellent stuff in those slides if you are interested in C/C++ :Thmbsup:

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Deep C Fishing
« Reply #1 on: October 10, 2011, 11:40 AM »
(page 226) "Suppose you want to change a value crossing a word boundary, you would need to read two words, mask out the value, change the value, mask and write back two words." ... not really precise enough for little miss precise, is it now? That really depends on the CPU you're compiling for - and if we take for instance x86, where you don't need the masking stuff instruction-set wise, the hardware would be dealing with cache and not just two words :)
- carpe noctem

Eóin

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 1,401
    • View Profile
    • Donate to Member
Re: Deep C Fishing
« Reply #2 on: October 10, 2011, 01:50 PM »
sally.png

:mad: Oh she annoys me so much... but some of that might be because she has pointed out stuff I missed.

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Deep C Fishing
« Reply #3 on: October 10, 2011, 01:54 PM »
:mad: Oh she annoys me so much... but some of that might be because she has pointed out stuff I missed.
:P - I'm a bit more than halfway now, and she hasn't brought something up I didn't knew (but I do admit I'm rusty on the finer points of sequencing points) - on the other hand, I wouldn't have answered simple questions with such detail.

I reeeeeally like the slide below - it's pretty true in my experience.
Spoiler
shot-2011-10-10@20.55.17.pngDeep C Fishing


EDIT: man, at page 350, flipping to the next page is unbearably slow in FireFox... 5+ seconds, with one CPU core pegged at 100% all the time. In IE9 it's consistently sluggish all the way through, but the rendering is messed up. WebApps, gotta love 'em.
- carpe noctem
« Last Edit: October 10, 2011, 02:19 PM by f0dder »

mwb1100

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,645
    • View Profile
    • Donate to Member
Re: Deep C Fishing
« Reply #4 on: October 10, 2011, 02:43 PM »
That's a pretty nice explanation of some topics that are difficult to teach. But, I have some comments/nit-picks (I think nit-picks are valid, since the slide deck mostly seems to be about being precise with the behavior and semantics of the language).

On page 24:
a declaration `int f();` says there is a function `f` that takes any number of arguments.

Might be more accurately:

a declaration `int f();` says there is a function `f` that takes an unspecified number of arguments. The caller is required to make sure the function is called with the correct number and type of arguments.


Page 243:

They use the `auto` keyword in its pre-C++11 incarnation!  I don't think I've ever seen it used outside of some old, old textbooks.  In fact, given its overall uselessness and that the keyword has been repurposed in C++11, I think the old use of the `auto` keyword should be stricken from tutorials, except perhaps to explain that you shouldn't ever use it.

Page 245:

I wish they identified which compiler gives a warning about using an uninitialized variable only in an optimized build - that seems to be a poor behavior for a compiler. I'm not saying this doesn't happen, but I'd like to be aware of where it does.

Page 255:

I wish they provided a reference for Stroustrup's self-assessment.  Just out of interest and in case anyone ever asks for my self-assessment, then I could provide some context.





f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Deep C Fishing
« Reply #5 on: October 10, 2011, 02:44 PM »
I wish they identified which compiler gives a warning about using an uninitialized variable only in an optimized build - that seems to be a poor behavior for a compiler. I'm not saying this doesn't happen, but I'd like to be aware of where it does.
GCC :) </troll>
- carpe noctem

Stoic Joker

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 6,646
    • View Profile
    • Donate to Member
Re: Deep C Fishing
« Reply #6 on: October 10, 2011, 05:32 PM »
In IE9 it's consistently sluggish all the way through, but the rendering is messed up. WebApps, gotta love 'em.
Strange, I tried just steadily clicking (in IE9) and it bounced right along right up to slide 120 (where I stopped) in maybe 20-30 seconds tops. Wasn't really paying much attention to the rendering at that speed, but it seemed to be all there. *Shrug*

f0dder

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
  • [Well, THAT escalated quickly!]
    • View Profile
    • f0dder's place
    • Read more about this member.
    • Donate to Member
Re: Deep C Fishing
« Reply #7 on: October 11, 2011, 01:35 PM »
In IE9 it's consistently sluggish all the way through, but the rendering is messed up. WebApps, gotta love 'em.
Strange, I tried just steadily clicking (in IE9) and it bounced right along right up to slide 120 (where I stopped) in maybe 20-30 seconds tops. Wasn't really paying much attention to the rendering at that speed, but it seemed to be all there. *Shrug*
Well, not as sluggish as in firefox, but sluggish compared to "come on, this is a fscking 2.4GHz quadcore" - probably around ~250-500ms for a pageflip, but at a consistent speed and low CPU usage all the way through.
- carpe noctem

Stoic Joker

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 6,646
    • View Profile
    • Donate to Member
Re: Deep C Fishing
« Reply #8 on: October 11, 2011, 05:38 PM »
Hm... I'm running an E6600, which a Core2 Duo 2.4Ghz. I timed it for this run and best I can do with a one finger click is about 5 clicks per second (I stopped on page 362). The display kept right up with the cadence and highest CPU usage was 60%, lowest was 3% and (approx) average was in the high teens.

It did hiccup about 3 times and take a full second to load a frame ... But 3 out of 300+, I'm ok with.