T < x < B

Too long to tweet, too short to blog.
Jan 07
Permalink
A common myth is that each CAS operation “goes on the bus”, and, given that the interconnect is a fixed a contended resource, use of CAS can impair scalability. That’s false. CAS can be accomplished locally — that is, with no bus transactions — if the line is already in M-state. CAS is usually implemented on top of the existing MESI snoop-based cache coherence protocol, but in terms of the bus, CAS is no different than a store.
Permalink
A POD type in C++ is defined as either a scalar type or a POD class. POD class has no user-defined copy assignment operator, no user-defined destructor, and no non-static data members that are not themselves PODs. Moreover, POD class must be an aggregate, meaning it has no user-declared constructors, no private nor protected non-static data, no bases and no virtual functions.
Permalink
ISO C99 supports compound literals. A compound literal looks like a cast containing an initializer. Its value is an object of the type specified in the cast, containing the elements specified in the initializer; it is an lvalue. As an extension, GCC supports compound literals in C89 mode and in C++.
Permalink
In ISO C99 you can give the elements in any order, specifying the array indices or structure field names they apply to, and GNU C allows this as an extension in C89 mode as well. This extension is not implemented in GNU C++.
Jan 06
Permalink
In order for the dynamic_cast operation, the typeid operator or exceptions to work in C++, RTTI must be enabled.
Permalink
One little-known usage pattern of the C preprocessor is known as “X-Macros”.
Permalink
Jan 04
Permalink
# The network is reliable.
# Latency is zero.
# Bandwidth is infinite.
# The network is secure.
# Topology doesn’t change.
# There is one administrator.
# Transport cost is zero.
# The network is homogeneous.
Permalink
So, we clearly see that for this obvious case, escape analysis optimizations did escape from Java 6. It is not available for the client VM, it is disabled by default and if you enable it for the server VM, it does not help significantly: thread safety overhead here stays at about 250%. Ideally, thread safety overhead should go down to 0% with escape analysis lock elision. However, we fortunately see that lock coarsening and biased locking do help a lot and bring the overhead down to about 50%.
Dec 26
Permalink
In computer programming, a semipredicate problem occurs when a subroutine intended to return a useful value can fail, but the signalling of failure uses an otherwise valid return value. The problem is that the caller of the subroutine cannot tell what the result means in this case.
Dec 18
Permalink

Why is there no standard laptop power adapter?

I’m not sure how many years of man-frustration have been spent agonizing over this problem, but it seems like a lot of resources could be pooled (i.e. QA screw-ups could be avoided) if there were some industry standard power adapters for laptops.

What do the laptop manufacturers stand to gain by creating their own, custom power adapters?

Dec 13
Permalink

Inversion of control

I just clicked on a suggested fix in NetBeans (stock configuration) where I had to catch a checked exception. It surrounded my statement with a try/catch block, imported logging, and logged the exception with the class name / a log level of severe in the catch block. I hadn’t used logging anywhere else in the application. I feel like some bounds have been overstepped.

Am I controlling the IDE, or is the IDE controlling me?

Dec 09
Permalink

xkcd tooltip

from urllib2 import urlopen
from lxml import etree

parser = etree.HTMLParser()
file = urlopen('http://xkcd.com')
tree = etree.parse(file, parser)
comic = tree.findall('//img[@title]')[1]
print comic.attrib['title']

Dec 01
Permalink
I’ve always found it odd/unintuitive that subpackages have no significance. com.foosoft.foo; is unrelated to com.foosoft.foo.bar;