Nuances in C: Struct Assignment in C

When I started this post, it was going to be a revolutionary post, talking about something that was really bothering me. As I have spent more time thinking about this, the answer seems so simple and obvious, still there was a time where I did not get this concept, so I here is a brief post on the topic, The question is, in straight C, will this work: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct point_t { int x,y; } Point; int main(int argc, char **argv) { Point a,b; int c[4] = {1, 2, 3, 4}; b = c; printf("b(%p) is now b[x] = %d, b[y] = %dn", &b, b.x, b.y); return 0; } In C++ this works no problem. Structs are teated like classes where all members have public scope. Assigning one struct to another simple implements the copy constructor that is created by the C++ language, but what about straight C? ...

March 13, 2008 · zacharyzacharyccom

Snowboarding in Taheo

Last weekend I was “dragged” by some friends up to Lake Tahoe for some fun in the snow. So, I’m not as much of an ace as I thought I’d be, but I had a good time, and I hope to get better. It was a good time and I was with some good friends, and I wish I had a photo of all of us together, but I don’t. (Even though a few of my friends, who will remain nameless, managed to bring me down a double black on my second day of snowboarding in 2 years). ...

March 12, 2008 · zacharyzacharyccom

Competition Etiquette

Yesterday I attended a cheerleading competition in San Jose put on by an organization known as GSSA 1Spirit. It was the first time I’ve actually been spectating at an All Star competition in quite a while. I watched about seven hours of cheerleading and was quite impressed by some of the west coast teams, especially some of the tumbling which is not as strong back in CT. I have one global comment that I need to make. We need to push cheerleading competition etiquette. Seriously people, we are all there to watch the sport, but I feel that people get so concerned with seeing their team compete, that they forget that there are tons of other parents, coaches and cheerleaders looking to watch the competition. Here are my general suggestions: ...

March 5, 2008 · zacharyzacharyccom

Software Quality, its about attention to detail

Software quality can be measured in many ways. Complexity, efficiency, executable size, these are just a few of the potential metrics. The bad news is that these aren’t normally mutually exclusive. Normally if you maximize one, you might reduce the others. The hardest part of being a developer is deciding where to sacrifice and potentially how to marry the important metrics for each component we write. ...

February 25, 2008 · zacharyzacharyccom

I Cannot think in Silence

I’m in the process of cleaning up some old files and folders that I have had lying around for many years. I stumbled upon this poem that I wrote, when I was roughly 12 years old. It’s not that great a poem, but I remember writing it because my father was banishing me to my room to work on homework, and I just couldn’t come up with anything, this was the result. ...

January 21, 2008 · zacharyzacharyccom