Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 29th, 2006, 6:53 PM   #11
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
You can do something like this though:
#define Max(x, y) (((x) > (y)) ? (x) : (y))
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old Apr 29th, 2006, 7:43 PM   #12
Narue
Professional Programmer
 
Narue's Avatar
 
Join Date: Sep 2005
Posts: 419
Rep Power: 4 Narue is on a distinguished road
>Narue, what are you so pissed about anyway
I'm not pissed about anything. Though I was a bit annoyed that you kept ignoring the valid help by saying it didn't answer your question. This suggests that all you want is the answer and you couldn't care less about learning anything.
__________________
Even if the voices aren't real, they have some pretty good ideas.
Narue is offline   Reply With Quote
Old Apr 29th, 2006, 8:36 PM   #13
leo1502
Newbie
 
Join Date: Apr 2006
Posts: 16
Rep Power: 0 leo1502 is on a distinguished road
Here's what happens when i try to avoid w and z:

> cat a.c
#include <stdio.h>
#define SmartMax(x,y)  (y>x) ? y : x 

int main()
{
 int x=8,y=6;
 SmartMax(x,y)=100;
 printf("%d\n",x);
 return 0;
}

> gcc -x c a.c
a.c: In function `main':
a.c:7: invalid lvalue in assignment
leo1502 is offline   Reply With Quote
Old Apr 29th, 2006, 9:04 PM   #14
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Maybe you could run down to Wal-Mart, buy some attention span, and re-read the thread.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Apr 29th, 2006, 9:17 PM   #15
stevengs
Professional Programmer
 
stevengs's Avatar
 
Join Date: May 2005
Location: Bad Nauheim, Germany
Posts: 436
Rep Power: 4 stevengs is on a distinguished road
does that come in a spray-can or a tube?
__________________
-Steven
"Is this a piece of your brain?" - Basil Fawlty
stevengs is offline   Reply With Quote
Old Apr 29th, 2006, 10:00 PM   #16
Dameon
Troll
 
Dameon's Avatar
 
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4 Dameon is on a distinguished road
Quote:
Originally Posted by stevengs
does that come in a spray-can or a tube?
Topical application couldn't be effective. For optimal attention span enhancement, I'd advise a suppository.
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270
Dameon is offline   Reply With Quote
Old Apr 30th, 2006, 1:27 AM   #17
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,221
Rep Power: 5 grumpy is on a distinguished road
Quote:
Originally Posted by leo1502
Here's what happens when i try to avoid w and z: <snip>
You're being bitten by the fact that some operators have higher precedence than others. Look at nnxion's post for a solution that addresses this.
grumpy is offline   Reply With Quote
Old Apr 30th, 2006, 10:46 AM   #18
leo1502
Newbie
 
Join Date: Apr 2006
Posts: 16
Rep Power: 0 leo1502 is on a distinguished road
Maybe you should get out more.

So formally, should the code in my first post return "y 6" or "y 100"?
leo1502 is offline   Reply With Quote
Old Apr 30th, 2006, 12:17 PM   #19
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Quote:
Maybe you should get out more.
Do the initials, "Dumb Effer", ring a bell when you look in the mirror?
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old May 4th, 2006, 11:34 AM   #20
leo1502
Newbie
 
Join Date: Apr 2006
Posts: 16
Rep Power: 0 leo1502 is on a distinguished road
Formally, should the code in my first post return "y 6" or "y 100"?
leo1502 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:55 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC