Julian Andres Klode: underscores and undefined behavior
As everyone should know, underscores in C are not cool, as they cause undefined behavior per 7.1.3:
end up redefining things we should not much more likely then the other two. But why were those solutions chosen in the first place, and what is the alternative? I cannot answer the first question, but for the second one, the obvious alternative is to use trailing underscores:
Filed under: General
All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use.Yet, they are widely used everywhere. Here are some examples:
[...]
If the program declares or defines an identifier in a context in which it is reserved (other than as allowed by 7.1.4), or defines a reserved identifier as a macro name, the behavior is undefined.
- inclusion guards in GLib:
__G_VARIANT_H__ - internal Python functions:
_PyUnicode_AsString - various macros in APT:
__deprecated,__hot
end up redefining things we should not much more likely then the other two. But why were those solutions chosen in the first place, and what is the alternative? I cannot answer the first question, but for the second one, the obvious alternative is to use trailing underscores:
- inclusion guards, defined behavior:
G_VARIANT_H__ - internal functions, defined behavior:
PyUnicode_AsString_ - various macros, defined behavior:
deprecated__,hot__
All identifiers that begin with an underscore are always reserved for use as identifiersMeaning that everything except for parameters, local variables and members of structs/unions that starts with an underscore is reserved. So, if you happen to create a variable
with file scope in both the ordinary and tag name spaces.
_mylibrary_debug_flag, you trigger undefined behavior as well. And while we re at it, do not think you can create a type ending in _t: POSIX reserves all identifiers ending in _t for its own use.
In summary, whenever you write C and want to be 100% safe of undefined-behavior-because-of-naming, do not start any identifier with an underscore and do not end any identifier with _t.
Filed under: General
Today, Marc has released
I'm playing with btrfs to get a feel for what's coming up in linux filesystems. To be daring, i've configured a test machine using only btrfs for its on-disk filesystems. I really like some of the ideas put forward in the btrfs design. (i'm aware that btrfs is considered experimental-only at this point). I'm happy to report that despite several weeks of regular upgrade/churn from unstable and experimental, i have yet to see any data loss or other serious forms of failure. Unfortunately, i'm not impressed with the performance. The machine feels sluggish in this configuratiyon, compared to how i remember it running with previous non-btrfs installations. So i ran some benchmarks. The results don't look good for btrfs in its present incarnation. UPDATE: see the comments section for revised statistics from a quieter system, with the filesystems over the same partition (btrfs is still much slower). The simplified test system i'm running has Linux kernel 2.6.39-rc6-686-pae (from experimental), 1GiB of RAM (no swap), and a single 2GHz P4 CPU. It has one parallel ATA hard disk (WDC WD400EB-00CPF0), with two primary partitions (one btrfs and one ext3). The root filesystem is btrfs. The ext3 filesystem is mounted at /mnt I used 
This June, soon after my seventh anniversary with Canonical, I will finish my job as Ubuntu CTO at Canonical. You can read


A brand new 0.9.4 release of

* Dear Lazyweb,
I have Macbook (Late 2008) model running Debian Sid + Mac OS X (sigh!) and I m facing nice issues which prevents me to full use of disk. They re:
1. CD-ROM drive doesn t work. So, if I want to upgrade to Snow Leopard or anything else, there is no other way.
2. Disk is 160 GB, I want to upgrade to better disk (say with better speed, capacity). Is there any way to clone entire disk (with partition preserved) and use it? Remember: I don t have CD-ROM
3. Is there any way to wipe-out Mac OS X and running Debian with hardware acceleration? I ve noticed that if you single boot Debian, it lacks Video acceleration.
Any pointers towards above 3 is appreciate. I ll hostname my computer if you help me to fix this ![[Individual interrupts - by month]](http://dkg.fifthhorseman.net/blog/i5000_edac/irqstats-month.png)
I also note that more rescheduling interrupts started happening, and fewer megasas interrupts at about the same time. I'm not sure what this means. A review of other logs and graphs on the system turns up no other evidence of interaction that might cause this kind of elevated activity. One thought was that the elevated activity was just due to writing out a bunch more logs. So i tried removing the i5000_edac module just to keep dmesg and /var/log/kern.log cleaner. Leaving that turned off doesn't lower the CPU utilization or change the interrupts, though. Any suggestions on what might be going on, or further diagnostics i should run? The machine is in production, and I'd really rather not take down the machine for an extended period of time to do a lengthy memory test. But i also don't want to see this kind of extra CPU usage (more than double the machine's baseline).Tags: