I happened across the following bit of C code at work today. It attempts to allocate storage for an incomplete type:
/* foo.c */
struct foo bar;
struct foo { int x; } bap;
I was surprised to find that this code compiles cleanly with GCC 3.4, Intel 8.1, and Comeau C/C++ 4.3.3 (apparently reserving 4 bytes for both bar and bap). Microsoft Visual C 8.0, however, produces the following error:
foo.c(1) : error C2079: 'bar' uses undefined struct 'foo'
MSVC’s error seems pretty reasonable to me. The primary characteristic of a C definition is that it reserves storage. If you don’t yet know the size of foo, you can’t reserve storage.
I’ve got a copy of the C language spec. Can someone point me to a relevant passage?
Update:
Upon review, it seems that this is indeed legal C. The Microsoft compiler should probably accept it. (Thanks to Jonathan Caves for looking at this.)
Google Finance launches today. Check it out. Finally, some competition for the old (stagnant) standby, Yahoo Finance.
Drank a bottle of two-buck Chuck tonight and learned how to play Another Kind of Green. The verse is rather Hendrixy, I think. I’ve convinced myself that drugs are an essential ingredient for writing such incredible music. This is self-serving — I can’t write shit like that. Maybe I should shut up and smoke something.
Right now, if I could go back to being 8 years old, I’d mess with guitars instead of computers. Hell, a piano would do… Whatever. 750-something FICO scores are boring. I’d rather be broke and interesting.
Can I trade my curly-braces for a treble clef? Not anymore.
It’s not the perfect hand, but I don’t hit on nineteen.
Thanks to my vacation, I’ve found a minor problem with (the otherwise stellar) Google Reader. There doesn’t seem to be any way to mark all messages as read.
I’ve got a 2 week backlog of stale articles I want to dispose of in one fell swoop.
Maybe this feature exists and I’m just missing it. Anyone?
What would a system with no volatile memory look like? Imagine a PC without DRAMs or a HDD — instead, what if we could have a terabyte hunk of very fast nonvolatile flash, or something?
I’ve been thinking about this question, on and off, for a few years now.
I think software would change a lot. What would it mean to install software? To load a program? To open a file?
I´m putting some serious miles on my Doc Martins. I think we´ve done 15 miles around Seville today. Kassidy is some kind of medical marvel — the girl just never gets tired of speed-walking all over the place.
This place is beautiful. The weather is nice, the people are nice, and we keep running into Americans. There are a lot of study-abroad types here.
Still, I´m ready for home. Tomorrow we take a high-speed AVE train back to Madrid in a zippy dos y media horas.
Blogging from the Navegaweb internet cafe in Granada…
This morning we ate Chocolat con Churros (again…we had them in Madrid too). Basically they give you these long pieces of fried dough and a big honkin´ cup of melted chocolate to dip them in. It goes without saying that this is delicious, but I´ll say it anyway.
Yesterday we saw (yet another) cathedral, which was beautiful and also completely boring. I´ve seen too many. Next however, we visited the Alhambra, which is an amazing fortress left over from the days of Moorish rule. Think Prince of Persia and Aladdin and stuff. It was different and very cool. We also went up into the AlbazÃn district, to the Miradór de San Nicolas (a scenic viewpoint). From here we had a great view of the Alhambra, with the Sierra Nevada mountains behind.
Our hotel here was great. It was cheap, 65€ (with a 20% discount for having the Rick Steves book). It was also clean, centrally located on Plaza Bib Ramblas, and had an out-of-this-world view from the 4th floor terrace.
There are these totally obnoxious Gypsy women all over town who try to force sprigs of rosmary on you, claiming ¨regalo, regalo¨, which means gift. We have a feeling their next move is to make you pay for it, but we´re not going to find out. I´ve been tempted to scream English obscenities at them.
Kassidy begs me to mention Coca-Cola Light. They don´t have Diet Coke out here, they have ¨Light¨ instead. She claims it tastes more like real Coke, and I think she´s right.
Next blog entry will be from Seville. Hasta Luego.
Today is my second and final day in Barcelona. This is a pretty cool town. I´m pretty worn out from all the walking, however. I need to start planning a real vacation following every Kassidy vacation.
I accidentally broke a bottle of vino tinto (red wine) inside my backpack. That was fun. We´ve got a new backpack now.
Things we did:
- Arrived on a overnight train from Madrid. Sleeping cars are cool.
- Stayed in an overpriced hotel near Las Ramblas
- Saw the Picasso Museum
- Went to a crazy and chaotic outdoor market
- Ate very well and drank lots of vino tinto
- Saw Cathedral de Barcelona
- Saw a bunch of Gaudi´s buildings, including the bizarre but beautiful La Sagrada Familia
- Viewed some ancient Roman ruins
- Saw the inspiration for the Barcelona level on Tony Hawk Underground 3
We´ve got a reservation for a Spanish guitar concert tonight. Immediately following that, we´ll be on another overnight train to Granada.
Adios
As the plane touched down this morning, it was 10AM local time. Our internal clocks, however, still read 1AM. Nothing a quick nap and some caffine can´t solve.
We took the subway from the airport — it was quick and clean. We´re staying in Hostal Acapulco, which is very nice (their free internet access is great).
Most of the day today was spent exploring the city. We ate some Jamón sandwiches, and later on, tapás. We also attended a show at Teatro Zarzuela. The nose-bleed seats were cheap. It was entirely in Spanish, so we didn´t miss much by being so far away.
Incidentally, my web server and DSL connection rock from here. In other nerd-related news, this keyboard is totally crazy: ÑéºÇ€ªá.
Now that I´ve gotten that out of my system, it´s time for bed. Adios.
Latest Comments
RSS