Does “undefined behaviour” extend to compile-time?

“You’re all ignoring the actual definition and focusing on the note, The standard imposes no requirements.” – @R.MartinhoFernandes The message above was written by the given user in Lounge<C++> and makes a very valid argument; the standard doesn’t impose any requirements when it comes to code that invokes undefined behavior. ! ! ! undefined-behavior stretches … Read more

Prevent launching multiple instances of a java application

You could use a FileLock, this also works in environments where multiple users share ports: String userHome = System.getProperty(“user.home”); File file = new File(userHome, “my.lock”); try { FileChannel fc = FileChannel.open(file.toPath(), StandardOpenOption.CREATE, StandardOpenOption.WRITE); FileLock lock = fc.tryLock(); if (lock == null) { System.out.println(“another instance is running”); } } catch (IOException e) { throw new Error(e); … Read more

Tagged pointers in Objective-C

OS X and iOS both use tagged pointer objects in 64-bit code. Neither currently uses any tagged pointer objects in 32-bit code, though in principle it’s not impossible. The specific set of optimized classes and optimized values changes frequently. Open-source objc4/runtime/objc-internal.h describes this set of classes that was used in at least one OS version: … Read more