wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
riddles >> cs >> Dark corners of C
(Message started by: Barukh on Mar 25th, 2013, 5:09am)

Title: Dark corners of C
Post by Barukh on Mar 25th, 2013, 5:09am
It's not a puzzle, but it's cool (https://docs.google.com/presentation/d/1h49gY3TSiayLMXYmRMaAEMl05FaJ-Z6jDOWOz3EsqqQ/preview#slide=id.p).

Title: Re: Dark corners of C
Post by peoplepower on Mar 25th, 2013, 5:37am
It turns out that auto was a good placeholder for a useful keyword in C++11.

Title: Re: Dark corners of C
Post by Grimbal on Mar 25th, 2013, 5:40am
I hope it doesn't break the code that is making use of that keyword.  ::)

Title: Re: Dark corners of C
Post by peoplepower on Mar 25th, 2013, 6:03am
Indeed, I cannot compile things like
auto int i = 0;
in the new standard.

Hm.. I would be hardpressed to figure out some ambiguous usage of auto.

Title: Re: Dark corners of C
Post by SMQ on Mar 25th, 2013, 12:20pm

on 03/25/13 at 06:03:31, peoplepower wrote:
Hm.. I would be hardpressed to figure out some ambiguous usage of auto.

double a = 0.0;
auto b = a;

In C, b will be an int (because a missing type implies int); in C++0x, b will be a double (because the type of an auto variable is implied by the type of the expression assigned to it).

Fortunately, in earlier versions of C++ this is a compiler error, because the missing-type-implies-int rule is only in straight C, not C++. So it's only a potential ambiguity if you're attempting to compile straight-C code as C++0x.

--SMQ

Title: Re: Dark corners of C
Post by peoplepower on Mar 25th, 2013, 6:10pm
Wow, I did not know that (probably for good reason).

Title: Re: Dark corners of C
Post by bal on Jul 5th, 2014, 7:41am
It's great, I've never heard about these stuffs  :)

Title: Re: Dark corners of C
Post by JaneBD on Aug 5th, 2014, 3:10pm
I've never heard of this ... what exactly is "Dark corners of C" - I get you're referring to the programming language, but is there something new I've not learnt about it?

Title: Re: Dark corners of C
Post by towr on Aug 5th, 2014, 11:24pm
Just click the link and read the presentation.
It's things you can, but probably shouldn't, do in C, because they're weird and/or evil.

Title: Re: Dark corners of C
Post by JaneBD on Aug 6th, 2014, 6:11am
That's actually pretty cool, thanks for sharing it (:



Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board