[nycbug-talk] Re: MSNBC on the decline of technology jobs
Jed Davis
jdev
Wed Jun 22 21:41:02 EDT 2005
In article <Pine.LNX.4.44.0506221357230.11177-100000 at bawx.pilosoft.com>,
<alex at pilosoft.com> wrote:
>
> If you want me to give examples in software development, my favorite
> interview question is "c=0; c=c++;" what is the value of c? The right
> answer is 'undefined', it can be 0, 1, or 500. Now, its all about how
> someone thinks about resolving this: Break the statement into operations,
> and try to figure whether assignment or post-increment will happen first.
> It shows whether you know what expression is, what rvalue/lvalue is, what
> the code is going to be *compiled* to, etc.
Huh. My thought process started with "Oh, that's one of the standard
examples of a sequence-point violation", and then I tried to remember if
that's actually full nasal-demons territory or if the Standard gives you
anything more (and I don't know offhand, but I suspect it's the former).
> C has a lot of "gotchas" - if you don't know them and can't recognize
> them, you'll fail my interview. I like to give examples that'd make a
> difference between signed int/unsigned int
/*
* This came up (in a much more complicated form)
* on the GCC list recently:
*/
signed int x = INT_MAX;
unsigned int y = UINT_MAX;
++x; ++y;
/* Now, what are the values of x and y? */
--
(let ((C call-with-current-continuation)) (apply (lambda (x y) (x y)) (map
((lambda (r) ((C C) (lambda (s) (r (lambda l (apply (s s) l)))))) (lambda
(f) (lambda (l) (if (null? l) C (lambda (k) (display (car l)) ((f (cdr l))
(C k))))))) '((#\J #\d #\D #\v #\s) (#\e #\space #\a #\i #\newline)))))
More information about the talk
mailing list