Published as BIP 103
From the putc
man page, "putc()
is equivalent to fputc()
except that it may be implemented as a macro which evaluates stream more than once."
I wasn't sure what this meant so I asked Shevek.
He launched into a lambda calculus explanation that eventually boiled down to: putc
may evaluate it's arguments more than once, but fputc
evaluates them exactly once.
This is because putc
is implemented as a macro and the C preprocessor just does string substitution, leading to examples like the ones below.
Ignoring what putc
and fputc
actually do, let's look at a simplified version where they both simply do one operation twice and another operation once:
I wanted to be really able to explain to a fair amount of detail how does the program :command:`ls` actually work right from the moment you type the command name and hit ENTER. What goes on in user space and and in kernel space? This is my attempt and what I have learned so far on Linux (Fedora 19, 3.x kernel).
How does the shell find the location of 'ls' ?
People
![]() :bowtie: |
๐ :smile: |
๐ :laughing: |
---|---|---|
๐ :blush: |
๐ :smiley: |
:relaxed: |
๐ :smirk: |
๐ :heart_eyes: |
๐ :kissing_heart: |
๐ :kissing_closed_eyes: |
๐ณ :flushed: |
๐ :relieved: |
๐ :satisfied: |
๐ :grin: |
๐ :wink: |
๐ :stuck_out_tongue_winking_eye: |
๐ :stuck_out_tongue_closed_eyes: |
๐ :grinning: |
๐ :kissing: |
๐ :kissing_smiling_eyes: |
๐ :stuck_out_tongue: |
/* | |
* Author : Pierre-Henri Symoneaux | |
*/ | |
#include <stdlib.h> | |
#include <string.h> | |
//Hashtable element structure | |
typedef struct hash_elem_t { | |
struct hash_elem_t* next; // Next element in case of a collision |
A lot of math grad school is reading books and papers and trying to understand what's going on. The difficulty is that reading math is not like reading a mystery thriller, and it's not even like reading a history book or a New York Times article.
The main issue is that, by the time you get to the frontiers of math, the words to describe the concepts don't really exist yet. Communicating these ideas is a bit like trying to explain a vacuum cleaner to someone who has never seen one, except you're only allowed to use words that are four letters long or shorter.
What can you say?
class StaticMethod(object): | |
def __init__(self, func): | |
self.func = func | |
def __get__(self, obj, cls): | |
return self.func | |
def staticmethod(func): |
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |