DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Deep C Fishing  (Read 10,584 times)

Jibz

  • Cold Warrior
  • Developer
  • Joined in 2005
  • ***
  • Posts: 1,187
    • Programming School - Stage 1 Medal
    • Coding Snacks
    • Participated in NANY Challenge Four Times
Deep C Fishing
« on: October 10, 2011, 02:07 PM »
http://www.slideshare.net/olvemaudal/deep-c

Some excellent stuff in those slides if you are interested in C/C++ :Thmbsup:
"A problem, properly stated, is a problem on it's way to being solved" -Buckminster Fuller
"Multithreading is just one damn thing after, before, or simultaneous with another" -Andrei Alexandrescu

f0dder

  • [Well, THAT escalated quickly!]
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
    • Participated in NANY Challenge Once
Re: Deep C Fishing
« Reply #1 on: October 10, 2011, 04:40 PM »
(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

  • O'Callaghan
  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 1,401
Re: Deep C Fishing
« Reply #2 on: October 10, 2011, 06:50 PM »
[attachimg=#]

:mad: Oh she annoys me so much... but some of that might be because she has pointed out stuff I missed.
Interviewer: Is there anything you don't like?
Bjarne Stroustrup: Marketing hype as a substitute for technical argument. Thoughtless adherence to dogma. Pride in ignorance.

f0dder

  • [Well, THAT escalated quickly!]
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
    • Participated in NANY Challenge Once
Re: Deep C Fishing
« Reply #3 on: October 10, 2011, 06: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 (click to show/hide)
[attachthumb=#]

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, 07:19 PM by f0dder »

mwb1100

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,645
Re: Deep C Fishing
« Reply #4 on: October 10, 2011, 07: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:
Quote
a declaration `int f();` says there is a function `f` that takes any number of arguments.

Might be more accurately:

Quote
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

  • [Well, THAT escalated quickly!]
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
    • Participated in NANY Challenge Once
Re: Deep C Fishing
« Reply #5 on: October 10, 2011, 07: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,652
    • Cody Award
    • Participated in NANY Challenge Five Times
Re: Deep C Fishing
« Reply #6 on: October 10, 2011, 10: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

  • [Well, THAT escalated quickly!]
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 9,153
    • Participated in NANY Challenge Once
Re: Deep C Fishing
« Reply #7 on: October 11, 2011, 06: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,652
    • Cody Award
    • Participated in NANY Challenge Five Times
Re: Deep C Fishing
« Reply #8 on: October 11, 2011, 10: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.

Original address: https://www.donationcoder.com/forum/index.php?topic=28302.0