View Single Post
  #13   Spotlight this post!  
Unread 15-02-2006, 19:27
aaeamdar's Avatar
aaeamdar aaeamdar is offline
Post-A-Holic
AKA: Paul Dennis
FRC #1719 (The Umbrella Corp)
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Baltimore, MD
Posts: 231
aaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant future
Re: A few simple programming questions;

Quote:
Originally Posted by Alan Anderson
Ooh, clever. Dangerous, but clever. It increments x unless it's already 100 or greater.
Code:
if (x < 100)
    x = x + 1;
It's true, C does give you enough rope to shoot yourself in the foot.
Yes it does. I came up with this one myself... a very interesting mix of metaphors there. I would use the ++ but it's all semantic.

But there is absolutely no reason to do this. It doesn't save you any time, and it doesn't save you an space in memory. However, there is, and I kid you not, a contest to obfuscate code. This is a fairly simple example of that.

Paul Dennis