Considering that:

  •     It’s best practice to do warning free builds.  Those harmless warnings you are ignoring could be hiding an important warning that’s bugging up your code.
  •     Recent version of GCC support disabling of specific warnings.
  •     Sometimes we use external libraries which we trust, or must accept — we don’t want to muck around with their internals — say for example the boost libraries.

Given these points, when we include a header which creates warnings, we’d like to disable just those warnings, for just those header files.  This can be done with the following statements for the GCC compiler:

#pragma GCC diagnostic ignored "-Wparentheses"
#pragma GCC diagnostic ignored "-Wswitch"
#include <tl_base_data.h>;
#pragma GCC diagnostic warning "-Wswitch"
#pragma GCC diagnostic warning "-Wparentheses"

This comes up often enough I cranked out a trivial bit of elisp so I can do this in emacs a bit more automatically:

 

; @todo let this work if we have a range too.
(defun insert-pragmas (pragma-name)
"Wrap the current line with a pragma to disable the warning."
(interactive "MWarning to disable: ")
(if (string= "" pragma-name)
(message "ignoring empty pragma name")
(move-beginning-of-line nil)
(insert "#pragma GCC diagnostic ignored \"-W" pragma-name "\"\n")
(move-end-of-line nil)
(insert "\n#pragma GCC diagnostic warning \"-W" pragma-name "\"\n")
)
)

Trayvon Martin

My response to the Trayvon Martin verdict has been complex. I didn’t follow the case closely, having read primarily superficial discussions of the case until that point. When I heard about the verdict I was disappointed but not surprised. When Rodney Kings attackers were acquitted I was shocked and surprised. The Zimmeran verdict shows that white America hasn’t gotten much more civilized. I think one could argue that black America has, since the response from black Americans has been reasoned and reasonable. One can hope it will effective as well.

I found some of the response worth commenting on. William Saletan wrote an article on Slate titled “Your Are Not Trayvon Martin”, which I found particularly disturbing.  His thesis is that:

The problem at the core of this case wasn’t race or guns. The problem was assumption, misperception, and overreaction. And that cycle hasn’t ended with the verdict. It has escalated.

He goes on to explain that Zimmerman wasn’t a racist, that the whole thing was a stupid sequence of event based on fear, overreaction and misperception.  All of the latter points would seem to be factually true.  Whether or not Zimmerman is a racist is a bit more of a difficult question.  Standards as to what constitute being a racist change over time.  Behavior an opinions which would have been considered egalitarian and progressive in 1892 would be considered backward and rampantly racist today.  The evidence does suggest that Zimmerman is no self-identifying racist longing for the glory days of slavery or the clan… but he would seem to be a racist to the extent that he finds a black teenager walking down the sidewalk in a hoody scary and suspicious.

Zimmerman’s attorney mad the assertion (28:02 of the video below) claims that Zimmerman would never have been charged with a crime, had Zimmerman been black. That’s an interesting assertion. Had Zimmerman been black and killed Trayvon Martin, would he have been charged? I don’t know. But I think we should ask ourselves some other questions:

  1. If Trayvon had been white, and Zimmerman black, what do you think would have happened.  The statistics would suggest the death penalty would be likely.
  2. If Trayvon had been white, would Zimmerman have acted as he did?
  3. Put yourself in Travon’s situation:  You’re walking to a friend’s home wearing a hoody and carrying a bag of skittles and soda pop.  Some guy starts giving you a hard time, so you run away.   He runs after you.  You defend yourself and he shoots you dead.  Wouldn’t you want the justice system to take some action against the guy?


I think it’s exceeding naive to think that race, prejudice and racial profiling had nothing to do with this sequence of events.  I’m annoyed at journalists’ attempts (like those of mr. Saletan) to dismiss people’s efforts to address the problems that black people still face in America.  People, including my white self, are angry and frustrated at this outcome and what it says about our society.

Our unwavering defense of Israel

Predictably, Jay Carney defended Israel’s recent strikes against Syria. The defense was the usual one:

“The transfer of sophisticated weapons to terrorist organizations like Hezbollah is certainly a concern and a threat to Israel, and they have the right to act in their own sovereign interest on … in response to those concerns.”

I like to play the universality game, applying our governments foreign-policy standards uniformly. So let’s pose a hypothetical: Advanced firearms being exported across the border to Mexico are a clear threat to Mexico, arming the drug cartels to the extent of being a threat to both the Mexican people and the Mexican state.

What would Carney say if Mexico started bombing firearm stores in Texas that are known to be providing weaponry to the drug cartels?

If anyone ever runs into him at a party, let me know what he says.

Slow Food

There’s a fantastic interview with Micheal Pollan about the Slow Food movement, that is completely worth watching:

I found the entire thing fascinating, but I was especially inspired by the protest organized by Carlo Petrini’s fantastic protest against McDonalds.  I think we should try to make a protest like that a tradition — once a year organize a pot luck against fast food.

gnu global, getting gtags to treat .h files as C++

I’m still experimenting with tagging in Emacs.  I think my current favorite is using gnu-global.

Unfortunately I just joined a team where all their c++ header files start with .h.  By default gnu-global treats these as c, and results are poor.  While I think there’s a more sophisticated way to handle the problem, I just use:

export GTAGSFORCECPP=””

Sponsor a Walmart Striker

I can’t think of a worse example of the failings of our economic system than Walmart.  Virtually everything that’s wrong with our economy is wrong with Walmart, typically to an extreme degree.

Walmart rules the “price is everything” universe, often by selling poor quality merchandise, poorly suited to its purpose.  Other times by selling the same merchandise available elsewhere, made cheaper by virtue of mass purchasing power, and exploitation of its workers.

In the eighties and Nineties Walmart spread like a cancer from small town to small town.  At first towns rejoiced at the arrival of Walmart with their huge stores, huge selections and cheap prices.  Gradually people awakened to a disturbing pattern however:  where Walmart went, small locally owned businesses died.  Once a town had a Walmart, your only job opportunities were Walmart jobs, which pay so poorly you can barely afford to shop at Walmart, let alone at a small locally owned business.

Now Walmart workers are fed up, and they are organizing.  They are planning a walk out on Black Friday, which is simply a brilliant idea.  The thing is, Walmart workers lead precarious lives, economically speaking.  Missing out on a day’s pay hurts.  That’s where we can all help.  You can sponsor a Walmart striker.    The organization page is here, and the donation page is here.

The Romney Video

I try not to follow the presidential race too closely, as I consider it the junk food of democracy:  addictive, but not very nourishing.  I was delighted to see the video of Mitt Romney showing his disdain for the working class get some traction in the mainstream press though.

Some months ago, Switzerland had a popular vote whether to increase the mandatory vacation time large firms offer their employees from 4 to 6 weeks.  One would think that such a bill would have been an easy win, but there was a very successful, well funded fear campaign against the initiative, which was based on the threat that longer vacation times would mean Swiss companies would become less competitive,  leading to more unemployment.

I was sitting in our employee cafeteria listening to one of my fellow working-class schlubs parrot this particular line of thought.  I told him that his analysis was based on poor assumptions.    The primary false assumption here is that employees who work less are, by definition, going to be less productive.  This is of course a false assumption.  Research has shown that stressed, overworked employees make mistakes and are less productive than well rested employees.   There are relevant and perhaps important debates which should be had on this subject, such as:

  • Do the Swiss labor laws create conditions of maximum productivity for employees (i.e. finding the perfect balance between stress and productivity)?
  • Should our legal system strive to create conditions of maximum productivity, or should we be striving for other goals, like work/life balance, or a healthy, happy society which has time to care for its health, children, culture, the elderly, and the environment?

I went on to tell him that the fact that the advertising campaign relies on fear, instead of a rational assessment of causes and effects, is a pretty good sign he should be skeptical.  Further, it’s well known that inside Europe, the Swiss relatively poor conditions:  longer working weeks and fewer vacations.  It’s also a common theme that stress-related illnesses cost the Swiss society and the Swiss economy enormously, and are considered a real problem.  Given these facts, there is reasonable evidence to think that a little extra holiday time might actually be good for the Swiss economy.

His response to this was the following question:  “If that’s true, why is every other country working to decrease holiday time and increase working hours?”.  I told him that that was precisely the question he should be asking.  If only the Romney video were available at that point, I could have pointed to it as evidence of the obvious answer:  because those countries are being run by wealthy people who feel like they should make a living simply by owning things, and those people have nothing but contempt for working people.

 

 

Penny-wise, pound-foolish

One of my frequent frustrations working for a large corporation is penny-wise, pound-foolish policies. Examples abound, but one annoys me at sufficient frequency and intensity to comment on it.

I have to print documents for reading or reference on occasion.  Often I would prefer to read them on my tablet, but my companies various security policies prevent me from doing so.  Working around the security policies would put me at risk (in terms of breaking company policy, not in terms of actual security), and would be time-consuming.  So I wind up printing them out.

Being an environmentally conscious guy I do so double sided, and generally 2 pages per side, so as to save on resources.  Typically the stuff I have to print out has some syntax-highlighted stuff, and maybe some figures with a little color in them.  Typically the color is sufficiently valuable that is worth reading it in color — The increased efficiency in understanding the content easily pays for the costs of the color.

But printing in color is more expensive than printing in  black-and-white.  Managerial classes do a lot of printing, and work with a lot of superfluous color: Big bold headers in color for visual style, pie charts, shit like that.  So in their wisdom, they have reasoned  that making all printing have the default to print to grayscale will save the company money.  As a result, whenever I need to print something in color (the usual case), I have to go through an annoying series of clicks to enable color printing.  Each time costs me a a minute or two.   When I haven’t done it in a while I lose a few minutes going over the gui trying to find the relevant fields to click.  Being a large corporation, this waste of time and energy is occuring hundreds of times a day.  That’s hundreds of minutes of time being lost.

The worst part is the psychological impact.  The company went to extra-expense to make it inconvenient to manually select color or b/w, because they don’t trust us enough to do it for ourselves.    Our time and concentration are disparaged as being worth less than the cost of a small amount of color toner.

Because we we can measure  the cost of printing supplies, we register cost-reduction.    The decreased productivity, reduction in employee satisfaction, and the ensuing increased turnover are puzzled over, but occur with a time-lag so connection are not made.    This pattern reveals itself again and again.

Collaborative work

I’m currently designing a fairly complex piece of software at work, and have to collaborate intensely with 2 colleagues about all decisions, and a number of colleagues about various subsets of the project.

In the process of design, I had a small, very obvious realization that profoundly affects the productivity and pace of our discussions:  start with what’s good.

I notice that when our meetings devolve into bickering, nitpicking, distraction, or one of the myriad of antiproductive patterns that meetings and discussions are prone to, there is generally a great deal of overlap in our apparently oppositional stances, but people are focusing on the contentious points rather than the what they all agree on.

Consider:  Colleague 1 proposes a design pattern (P1) for use for a particular pattern.  Another Colleage 2 says “no that’s the wrong pattern for this because of bla bla bla”.    C2 is technically correct.  There are a number of flaws in how C1 has expressed his suggestion, but if one takes the time to sketch out the class diagrams and write out what will actually happen during thread execution, one sees that the class-structure imposed by the pattern is indeed a good fit, even if it doesn’t fit all the characteristics the pattern implies. 

If you nitpick about everything that’s wrong about the idea you get away from the productive part of the discussion, you’re likely to raise the other colleague’s temper and it rapidly becomes unlikely that any productive work gets done.  If you start out with a discussion like “okay, what are you thinking of here, how would it work, okay yeah I see what you mean… but you know the term <whatever> is maybe not completely accurate here because of <whatever>, but who cares, the idea is a good one” then you can switch the detail points that you want to fix, but you’ve established some common ground, you’ve made your colleague feel like you appreciate their input and their intellect, and you’ve established a productive, friendly tone that makes the colleague receptive to constructive criticism.

Further, if you are actually wrong in your nitpicking, you come across as less of an asshole.

All this seems really trivial, but it’s amazing how rarely it actually gets practiced.

A Teachable Moment

I had a teachable moment this morning. I was on my way to work. On the train I was working on my laptop, writing a rebutall to the asinine, wrong, and wrong headed coding policies some of my colleagues are trying to get accepted as coding standards within the company. This is a stressful activity to me, and gets me fairly
tense and agitated internally.

As the train halted at my stop, I stood back and waited for a man to help a woman get her baby carriage off the train. I was slightly miffed when someone standing next to me took this as an opportunity to shoulder between me and said carriage in order to et off the train faster. In this tense, agitated and slightly miffed frame of mine I took the first stair off the train. A young man was trying to shoulder his way up the train despite the fact that there were
still a number of people debarking the train.

Because of my frame of mind, I guess I was feeling a little confrontational. I certainly felt some anger well up in my chest as I put my hand on his chest and said (in english) “you should wait until everyone is finished getting off the train”. I was tensed and ready for a confrontation.

Instead, the young man said “Oh entschuldigung, thank you” and stepped back off the train. My first reaction was guilt and shame for being so angry at such a nice man. My second was relief that I hadn’t been ruder or more confrontational. If he has a generous heart (and evidence would indicate that this is the case), he might interpret my actions as firm but polite, even if I was being an confrontational asshole on the insde.

My final reaction was a warm feeling of gratitude. The gentleman in question behaved exactly as I strive to behave (even though I was behaving badly). Often when I preach that kind of behavior, I’m told I’m naiive or idealistic. So it was
nice to have an encounter where another person to behave exemplary.