• Turtle (unregistered)

    How about...

    private int GetMessage( int selected ) { return ( selected%4!=selected ? 0 : selected); }

  • .sau (unregistered)

    using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Web; using System.Web.Services;

    namespace GetMessageService { public class GetMessageService : System.Web.Services.WebService { public GetMessageService() { InitializeComponent(); }

    	[WebMethod]
    	public string GetMessage(int selected)
    	{
    		index = 0;
    		switch (selected)
    		{
    			case 0:
    				return 0;
    				break;
    
    			case 1:
    				return 1;
    				break;
    
    			case 2:
    				return 2;
    				break;
    
    			case 3:
    				return 3;
    				break;
    		}
    
    		return index;
    	}
    }
    

    }

  • Per (unregistered)

    Looks like a methodstub for some more sensible functionality... Maybe it shouldn't been checked into source-control, but still...

    I miss FILE_NOT_FOUND!

    captcha "berätta för lina!"

  • Aaron (unregistered)

    That method not only ignores extensibility but doesn't properly cache its results. Here's a much better implementation:

    enum MessageResultType
    {
        Zero = 0,
        One = 1,
        Two = 2,
        Three = 3
    }
    
    abstract class MessageResult
    {
        public abstract int GetValue();
    }
    
    class ZeroMessageResult : MessageResult
    {
        private const int Value = 0;
    
        public override int GetValue()
        {
            return Value;
        }
    }
    
    class OneMessageResult : MessageResult
    {
        private const int Value = 1;
    
        public override int GetValue()
        {
            return Value;
        }
    }
    
    class TwoMessageResult : MessageResult
    {
        private const int Value = 2;
    
        public override int GetValue()
        {
            return Value;
        }
    }
    
    class ThreeMessageResult : MessageResult
    {
        private const int Value = 3;
    
        public override int GetValue()
        {
            return Value;
        }
    }
    
    class InvalidMessageResult : MessageResult
    {
        private const int Value = 0;
    
        public override int GetValue()
        {
            return Value;
        }
    }
    
    class MessageResultFactory
    {
        public static MessageResult CreateMessageResult(MessageResultType type)
        {
            switch (type)
            {
                case MessageResultType.Zero:
                    return new ZeroMessageResult();
                case MessageResultType.One:
                    return new OneMessageResult();
                case MessageResultType.Two:
                    return new TwoMessageResult();
                case MessageResultType.Three:
                    return new ThreeMessageResult();
                default:
                    return new InvalidMessageResult();
            }
        }
    
        public static MessageResult CreateMessageResult(int typeIndex)
        {
            int[] resultTypeValues = (int[])Enum.GetValues(typeof(MessageResultType));
            bool isTypeFound = false;
            foreach (int resultTypeValue in resultTypeValues)
            {
                if (resultTypeValue == typeIndex)
                {
                    isTypeFound = true;
                    break;
                }
            }
            return isTypeFound ? CreateMessageResult((MessageResultType)typeIndex) : new InvalidMessageResult();
        }
    }
    
    class WtfService : System.Web.Services.WebService
    {
        private Dictionary<int, MessageResult> cachedResults = new Dictionary<int, MessageResult>();
    
        [WebMethod]
        public int GetMessageTest(int selected)
        {
            return GetMessage(selected);
        }
    
        private int GetMessage(int selected)
        {
            MessageResult result;
            if (!cachedResults.TryGetValue(selected, out result))
            {
                result = MessageResultFactory.CreateMessageResult(selected);
                cachedResults.Add(selected, result);
            }
            return result.GetValue();
        }
    }
    

    Yes, it actually, seriously works. How much do I get paid?

  • Unklegwar (unregistered) in reply to Anontoo
    Anontoo:
    private int GetMessage( int selected ) { return (selected > 3)? 0 : selected); }

    Bzzzzzzzzzt. What about negative values of selected? Those xlate to 0.

  • trianglman (unregistered) in reply to acne
    acne:
    hpeg:
    145,146c14,1
    < int result = GetMessage( moose );
    ---
    > int result = Math.min( Math.max(moose, 0), 3 );
    
    ((moose + abs(moose)) / 2 + 3 - abs((moose + abs(moose)) / 2 - 3)) / 2
    
    Hint : max(a,b) = (a + b + abs(a - b)) /2 and min(a,b) = (a + b - abs(a - b)) / 2

    I'm doing the math for these, and they don't seem to add up right.

    Correct me if I am wrong but if moose=5: result = Math.min(Math.max(5,0),3); result = Math.min(5,3); result = 3; //!=0 like the original code would return

    or ((5+abs(5))/2+3-abs((5+abs(5))/2-3))/2 (10/2+3-abs(10/2-3))/2 (5+3-abs(5-3))/2 (8-2)/2 6/2=3 !=0

  • (cs)
    final static int BIG_ENOUGH = 31337;
    
    int getMessage(int selected) {
        for(int i=0; i< BIG_ENOUGH; i++) {
            int message = (int) (Math.random() * 4);
            
            if( message == selected ) {
                return message;
            }
        }
        return 0;
    }
    
  • El Quberto (unregistered) in reply to The Swami of Salami
    The Swami of Salami:
    However silly that function looks, it does map values outside of (1,2,3) to 0.

    That's easy to fix, just wrap the method with an AOP method to add one to the result if it is 0. Now you have 1,2,3 and 4.

  • (cs)

    (I'm not a Java/C#er here, but it ought to make sense to them anyway) [#include <algorithm> and <list> is implied, of course]

      int GetMessage( int selected )
      {
          std::list<int> indexes;
          int return_index;
          
          // Create list of allowed index values
          int newindex1 = 0;
          indexes.push_back(newindex1);
          int newindex2 = 1;
          indexes.push_back(newindex2);
          int newindex3 = 2;
          indexes.push_back(newindex3);
          int newindex4 = 3;
          indexes.push_back(newindex4);
    
          // Ensure list is sorted in ascending order
          // 12/01/2007 changed to built in sort - apparently it is faster than bubble sort ????
          indexes.sort();
    
          // Look through the list for selected
          while (indexes.empty() != true)
          {
              return_index = indexes.front();
              indexes.pop_front();
              if (return_index == selected)
              {
                  // Remove the rest of the list to get out of loop
                  while (indexes.empty() != true)
                  {
                      indexes.pop_front();
                      // For extra speed pop back too
                      if (!indexes.empty())    // ! is super fast operator
                      {
                          indexes.pop_back();
                      }
                  }
    
                  // Double check that list is empty
                  if (indexes.empty() == false)
                  {
                      indexes.clear();
                  }
              }
          }
    
          // Check if we found the index in the list
          if (return_index != selected)
          {
              // set to default value
              return_index = 0;
          }
    
          // Make sure list is empty before we finish
          if (indexes.empty() == false)
          {
              indexes.clear();
          }
    
          return return_index;
      }
    
  • (cs) in reply to Optimizer
    Optimizer:
    Here's another variant, for flavor.

    private int GetMessage( int selected ) { static const int ONE = 1; int index = 0;

    // Get the Message
    switch( selected )
    {
        case 0: index += ONE;
        case 1: index += ONE;
        case 2: index += ONE;
        case 3: index += ONE;
    }
    
    return index;
    

    }

    Curses! That was my idea!

    At least mine works...

    private int GetMessage( int selected )
    {
        int index = 0;
        
        // Get the Message
        switch( selected )
        {
            case 3: ++index;
            case 2: ++index;
            case 1: ++index;
        }
        
        return index;
    }

    alternatively:

    private int GetMessage( int selected )
    {
        int index = 0;
        
        // Get the Message
        while( selected ) switch( selected-- )
        {
            case 1: ++index; break;
            case 2: ++index; break;
            case 3: ++index; break;
        }
        
        return index;
    }
  • EV (unregistered)

    Ok, so this code is C++... so what? for(int i = INT_MAX; i > 0; i--) if(i == selected && i < 4) return i; return 0;

    Optimized for speed, obviously... Or maybe I should unroll the loop...?

  • hpeg (unregistered) in reply to trianglman
    trianglman:
    acne:
    hpeg:
    145,146c14,1
    < int result = GetMessage( moose );
    ---
    > int result = Math.min( Math.max(moose, 0), 3 );
    
    ((moose + abs(moose)) / 2 + 3 - abs((moose + abs(moose)) / 2 - 3)) / 2
    
    Hint : max(a,b) = (a + b + abs(a - b)) /2 and min(a,b) = (a + b - abs(a - b)) / 2

    I'm doing the math for these, and they don't seem to add up right.

    Correct me if I am wrong but if moose=5: result = Math.min(Math.max(5,0),3); result = Math.min(5,3); result = 3; //!=0 like the original code would return

    or ((5+abs(5))/2+3-abs((5+abs(5))/2-3))/2 (10/2+3-abs(10/2-3))/2 (5+3-abs(5-3))/2 (8-2)/2 6/2=3 !=0

    result = (moose<0?0:moose>3?0:moose);
  • Rocca (unregistered)

    I didn't see a comment with a for statement.

    #define ZERO 0; #define ONE=1; #define MINUSONE=-1;

    private int GetMessage(int selected) { int parameter = selected;

    if (parameter <= -1) return ZERO;
    if (parameter >= 4) return ZERO;
    
    //Float BugFix
    if (parameter < 0) return ZERO;
    if (parameter > 3) return ZERO;
    
    int index = 0;
    
    for (int counter = 0; counter <= index; counter = counter + 1)
    {
    	index = index + ONE;
    }
    
    index = index + MINUSONE;
    
    return index;
    

    }

  • Peter Antoine (unregistered) in reply to Paul J
    Paul J:
    OK, more bit-twiddling an added evilness:

    int getmessage (int c) { return (!(c&~3))["(c&3)"]&c&3; }

    OK, put me out of my misery, but what does the ["(c&3)"] do?

    CAPTCHA: ewww --- enough said.

  • Turtle (unregistered) in reply to hpeg
    hpeg:
    trianglman:
    acne:
    hpeg:
    145,146c14,1
    < int result = GetMessage( moose );
    ---
    > int result = Math.min( Math.max(moose, 0), 3 );
    
    ((moose + abs(moose)) / 2 + 3 - abs((moose + abs(moose)) / 2 - 3)) / 2
    
    Hint : max(a,b) = (a + b + abs(a - b)) /2 and min(a,b) = (a + b - abs(a - b)) / 2

    I'm doing the math for these, and they don't seem to add up right.

    Correct me if I am wrong but if moose=5: result = Math.min(Math.max(5,0),3); result = Math.min(5,3); result = 3; //!=0 like the original code would return

    or ((5+abs(5))/2+3-abs((5+abs(5))/2-3))/2 (10/2+3-abs(10/2-3))/2 (5+3-abs(5-3))/2 (8-2)/2 6/2=3 !=0

    result = (moose<0?0:moose>3?0:moose);

    So basically (assuming 32 bit integers)

    result = ((-moose)>>31)*((moose-3)>>31)*moose;
  • Robin (unregistered)

    This annoys me greatly, who the frack paid this guy at all?

  • Marcin (unregistered)

    Exercise: Rewrite this function recursively. Extended: Use Y,S, or K combinators to write the function.

  • an actual coder (unregistered)

    Oh yes it can be real. I have seen this code style before except it went up till 20 or so instead. And I thought that guy was the only one who could come up with it but I guess I was wrong. For once.

  • (cs) in reply to jensenjoe
    jensenjoe:
    I think this is more eloquently styled:

    ...

    volatile const int table[4] = { ZERO, ONE, TWO, THREE };

    ...

    Awesome -- I love the implication that some external actor might come in and change the values of zero through three. (clearly, this is running on some piece of hardware with an input buffer). Bonus points for returning table[ZERO] after this happens as was suggested later on.

  • Harry (unregistered)

    Don't miss out on the opportunities provided by the Java < 1.5 enum design pattern:

    public final class MessageIndex { private Integer id; private static Integer upperBound = Integer(-1);

    Integer getUpperBound() {
       return upperBound;
    }
    
    private MessageIndex(Integer anID) {
      this.id = anID;
    this.ord = upperBound++;
    }
    public static Integer size() { return Integer(upperBound); }
    
    public static final MessageIndex ZERO = new MessageType(Integer(0));
    public static final MessageIndex ONE = new MessageType(Integer(1));
    public static final MessageIndex TWO = new Integer(Integer(2));
    public static final MessageIndex THREE = new MessageType(Integer(3));
    

    }

    public class MessageIndexException extends Exception { }

    private Integer GetMessage( Integer selected ) throws MessageIndexException { Integer index = Integer(0);

      if (index.intValue() >= MessageIndex.getUpperbound.intValue()) 
           throw new MessageIndexException("Message Index Greater Than Max Defined Value")
    
      if (index.intValue() < ZERO.intValue()) 
           throw new MessageIndexException("Message Index  Less Than ZERO object value")
    
      // Get the Message
      switch( selected.intValue() )
      {
    
          case 0:
              index = ZERO;
              break;
    
          case 1:
              index = ONE;
              break;
    
          case 2:
              index = TWO;
              break;
    
          case 3:
              index = THREE;
              break;
    
      }
    
      return index;
    

    }

    Not only does the above create more lines of code, but it requires that whoever calls it handle exceptions, wrap ints, etc.

  • (cs) in reply to Robin

    Two pages of comments, and nobody suggested a way to do it using XML?!

  • Paul J (unregistered) in reply to Peter Antoine
    Peter Antoine:
    Paul J:
    OK, more bit-twiddling an added evilness:

    int getmessage (int c) { return (!(c&~3))["(c&3)"]&c&3; }

    OK, put me out of my misery, but what does the ["(c&3)"] do?

    CAPTCHA: ewww --- enough said.

    Ahem. I said it was evil. OK:

    With a string literal we can do

    "abc"[1]

    which is 'b'. But a[b] is the same as b[a], so we could also write

    1["abc"]

    which is also 'b'.

    Now (!(c&~3)) will be 0 or 1 depending on whether c is between 1 and 3, so we get either '(' or 'c', which is then anded with c&3. I'll leave the rest up to you...

  • hpeg (unregistered) in reply to Turtle

    No wonder we're skint if we code like that...

  • Maks Verver (unregistered)

    I'll go with:

    int GetMessage(int s)
    {
        return s&~3 ? 0 : s;
    }
    Can this be improved? (I doubt it!)
  • (cs) in reply to trianglman
    trianglman:
    acne:
    hpeg:
    145,146c14,1
    < int result = GetMessage( moose );
    ---
    > int result = Math.min( Math.max(moose, 0), 3 );
    
    ((moose + abs(moose)) / 2 + 3 - abs((moose + abs(moose)) / 2 - 3)) / 2
    
    Hint : max(a,b) = (a + b + abs(a - b)) /2 and min(a,b) = (a + b - abs(a - b)) / 2

    I'm doing the math for these, and they don't seem to add up right.

    Correct me if I am wrong but if moose=5: result = Math.min(Math.max(5,0),3); result = Math.min(5,3); result = 3; //!=0 like the original code would return

    or ((5+abs(5))/2+3-abs((5+abs(5))/2-3))/2 (10/2+3-abs(10/2-3))/2 (5+3-abs(5-3))/2 (8-2)/2 6/2=3 !=0

    Well... you are right! My solution yields 3 every time moose > 3 In fact, I translated blindly hpeg's solution without seeing it was wrong :-/

    min(max(5, 0), 3) = min(5, 3) = 3 != 0

    This should work :

    (((moose + abs(moose)) / 2 + 4 - abs((moose + abs(moose)) / 2 - 4)) / 2) mod 4

    :-D

  • (cs) in reply to Paul J
    Paul J:
    Peter Antoine:
    Paul J:
    OK, more bit-twiddling an added evilness:

    int getmessage (int c) { return (!(c&~3))["(c&3)"]&c&3; }

    OK, put me out of my misery, but what does the ["(c&3)"] do?

    CAPTCHA: ewww --- enough said.

    Ahem. I said it was evil. OK:

    With a string literal we can do

    "abc"[1]

    which is 'b'. But a[b] is the same as b[a], so we could also write

    1["abc"]

    which is also 'b'.

    Now (!(c&~3)) will be 0 or 1 depending on whether c is between 1 and 3, so we get either '(' or 'c', which is then anded with c&3. I'll leave the rest up to you...

    Oh My Dear Lord!

    I had forgotten using C[++] for doing horrible stuff like that (for laughs, of course).

  • wiregoat (unregistered) in reply to acne

    None of you are going to have the Canadian twin problem.

  • (cs) in reply to snoofle
    Two pages of comments, and nobody suggested a way to do it using XML?!
    WTF?

    ...

    I know, you can use AJAX (that includes XML) to do a request to a server somewhere on the other side of the world to get the right result value. Added bonus for the person that starts the server localy when the remote server is not available.

  • (cs) in reply to Benanov
    Benanov:
    acne:
    Hint : max(a,b) = (a + b + abs(a - b)) /2 and min(a,b) = (a + b - abs(a - b)) / 2

    I have never seen that before, but that is a beautiful piece of mathematics. I have never thought about it before, but it makes sense.

    What's the bigger of two numbers? Find the midpoint between the two numbers, and then add half the distance.

    Subtracting half the distance yields the minimum.

    Kudos to you for sharing that with me!

    You're welcome!

    I saw such constructs in algorithm class. My teacher was quite fond of 'alternative' ways of doing things.

    Another one: how do you swap the values of 2 int variables without using a third variable?

    a = a + b
    b = a - b
    a = a - b
  • Tom (unregistered)

    Should have been using python:

    GetMessage = lambda x: x

  • Chad (unregistered)

    Bah!

    #DEFINE GetMessage(x) x

  • eloj (unregistered)

    Clean and elegant.

    return (selected & 3) == selected ? selected : 0;

    But I get that that's not the point of the exercise.

  • Kennie Nybo Pontoppidan (unregistered)

    fun GetMessage 1 = 1 | GetMessage 2 = 2 | GetMessage 3 = 3 | GetMessage 4 = 4 | GetMessage other = 0

  • Anonymous (unregistered) in reply to Paul J
    Paul J:
    This is fine with gcc; your milage may vary with other compilers definitions of true:

    int getmessage (int value) { return -!(x&~0x3)&x; }

    Which version of gcc defines x out of thin air?
  • Benjamin (unregistered)

    Of course it is a bad code: It uses "magical" numbers instead of constants, and it is also not flexible enough.

    Here is it corrected:

    private int GetMessage( int selected )
    {
    int index = 0;

      // Get the Message
      switch( selected )
      {
    
          case MyCompany.Me.MyUtils.Math.Constants.intZero:
              index = selected;
              break;
    
          case MyCompany.Me.MyUtils.Math.Constants.intOne:
              index = selected;
              break;
    
          case MyCompany.Me.MyUtils.Math.Constants.intTwo:
              index = selected;
              break;
    
          case MyCompany.Me.MyUtils.Math.Constants.intThree:
              index = selected;
              break;
    
      }
    
      return index;
    

    }

  • Katalgar (unregistered)
    private int GetMessage( int selected )
      {
           selected = abs(selected);
           if(selected>3)
           {
               return 0;
           }
           return selected;
      }
    
  • (cs) in reply to Aaron
    Aaron:
    That method not only ignores extensibility but doesn't properly cache its results. Here's a much better implementation:
    enum MessageResultType
    {
        Zero = 0,
        One = 1,
        Two = 2,
        Three = 3
    }
    

    abstract class MessageResult { public abstract int GetValue(); }

    class ZeroMessageResult : MessageResult { private const int Value = 0;

    public override int GetValue()
    {
        return Value;
    }
    

    }

    class OneMessageResult : MessageResult { private const int Value = 1;

    public override int GetValue()
    {
        return Value;
    }
    

    }

    class TwoMessageResult : MessageResult { private const int Value = 2;

    public override int GetValue()
    {
        return Value;
    }
    

    }

    class ThreeMessageResult : MessageResult { private const int Value = 3;

    public override int GetValue()
    {
        return Value;
    }
    

    }

    class InvalidMessageResult : MessageResult { private const int Value = 0;

    public override int GetValue()
    {
        return Value;
    }
    

    }

    class MessageResultFactory { public static MessageResult CreateMessageResult(MessageResultType type) { switch (type) { case MessageResultType.Zero: return new ZeroMessageResult(); case MessageResultType.One: return new OneMessageResult(); case MessageResultType.Two: return new TwoMessageResult(); case MessageResultType.Three: return new ThreeMessageResult(); default: return new InvalidMessageResult(); } }

    public static MessageResult CreateMessageResult(int typeIndex)
    {
        int[] resultTypeValues = (int[])Enum.GetValues(typeof(MessageResultType));
        bool isTypeFound = false;
        foreach (int resultTypeValue in resultTypeValues)
        {
            if (resultTypeValue == typeIndex)
            {
                isTypeFound = true;
                break;
            }
        }
        return isTypeFound ? CreateMessageResult((MessageResultType)typeIndex) : new InvalidMessageResult();
    }
    

    }

    class WtfService : System.Web.Services.WebService { private Dictionary<int, MessageResult> cachedResults = new Dictionary<int, MessageResult>();

    [WebMethod]
    public int GetMessageTest(int selected)
    {
        return GetMessage(selected);
    }
    
    private int GetMessage(int selected)
    {
        MessageResult result;
        if (!cachedResults.TryGetValue(selected, out result))
        {
            result = MessageResultFactory.CreateMessageResult(selected);
            cachedResults.Add(selected, result);
        }
        return result.GetValue();
    }
    

    }


    This is clearly the best implementation. Add some SQL and temp tables and we've got a winner.

  • tuffy (unregistered)

    I think the proper Python version should be:

    def GetMessage(selected): return dict([(x,x) for x in range(4)]).get(selected,0)

  • eloj (unregistered)

    Maks version turns out to save about two ops. Really thought the optimizer would turn it into virtually the same code, but no such luck.

    ; return selected & ~3 ? 0 : selected; get_maks: movl 4(%esp), %eax movl $0, %edx testl $-4, %eax cmovne %edx, %eax ret

    ; return (selected & 3) == selected ? selected : 0; get_eloj: movl 4(%esp), %eax movl %eax, %edx andl $3, %edx cmpl %edx, %eax movl $0, %edx cmovne %edx, %eax ret

  • Turtle (unregistered) in reply to acne
    acne:
    Another one: how do you swap the values of 2 int variables without using a third variable?
    a = a + b
    b = a - b
    a = a - b
    a=a^b=b^a=a^b;

    Best line of code ever.

  • <3lylegs (unregistered) in reply to Maks Verver
    Maks Verver:
    I'll go with:
    int GetMessage(int s)
    {
        return s&~3 ? 0 : s;
    }
    Can this be improved? (I doubt it!)
    Because you ask, yes it can.

    Removing the conditional element for example. return !(s&~3)*s Although Java will probably throw a tantrum because of the int->bool->int casts. But I assume java can be coerced.

  • facetious (unregistered)

    :s/GetMessage((.*))/((\1) % 4)/g

  • (cs)

    for (int i=0;i<10;i++) while(i!=11) return FILE_NOT_FOUND; //brilliant!!

  • Max (unregistered) in reply to Turtle

    I used a^=b^=a^=b; (which I think only compiles with GCC) in an interview once, and sufficiently confused the interviewer to assure myself the job :)

    Max

  • eloj (unregistered)

    ; return !(selected & ~3)*selected; get_legs: movl 4(%esp), %eax xorl %edx, %edx testl $-4, %eax sete %dl imull %edx, %eax ret

    On i686/gcc4.1.2 your code trade a cmov for a flagset and an imul.

    IKN.

  • yaxu (unregistered)

    In haskell:

    getMessage = id

  • (cs) in reply to acne
    acne:
    Hint : max(a,b) = (a + b + abs(a - b)) /2 and min(a,b) = (a + b - abs(a - b)) / 2
    Do you know how long it's been that I've wanted a deterministic (i.e., not relying on conditionals) representation of min/max?

    How sad it is that this is the first time that I've ever seen this representation (after at least 17 years of mathematics and around 6 of computer science)!

    This makes me even more angry at my teacher that told me the answer to "how do I compute sqrt(x) by hand?" was "punch the sqrt key on your calculator."

  • Paul J (unregistered) in reply to Max
    Max:
    I used a^=b^=a^=b; (which I think only compiles with GCC) in an interview once, and sufficiently confused the interviewer to assure myself the job :)

    Max

    Unfortunately the latest gcc compiler warns that the result is undetermined, and it doesn't swap them. Guess who had to go through their code when we upgraded recently... ;-(

  • The Swami of Salami (unregistered) in reply to Nanashi

    Hey Mr. Jaded, at least write a function that has the same behavior as the original.

  • facetious (unregistered) in reply to facetious
    facetious:
    :s/GetMessage(\(.*\))/((\1) % 4)/g

    ...yeah, that shouldn't be "((\1) % 4)". That should be "(\1)>3?0:((\1)<1?0:(\1))". Either way.. screw functions.

    And if you must use a function (or refuse to use vim)..

    #pragma GetMessage( x ) (x)>3?0:((x)<1?0:(x))

    It's been a while since I used C. :( Don't hate me if I used pragma where I should've used define.

Leave a comment on “Paid by the Line”

Log In or post as a guest

Replying to comment #:

« Return to Article