Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
C coding challenge
Goto page Previous  1, 2
 
Post new topic   Reply to topic Printable version
 View previous topic  Fibonacci Series into a Really Large N... Post :: Post C++ : Inheritance,Template and Threads...  View next topic  
Author Message
Bak
?ls -s
0 in


Age:24
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Fri Aug 07, 2009 7:54 pm    Post subject: Reply to topic Reply with quote

almost

Code: Show/Hide
..\main.c:6: warning: use of conditional expressions as lvalues is deprecated
..\main.c:6: error: invalid operands to binary ^
..\main.c:6: error: invalid operands to binary ^
..\main.c:6: error: invalid lvalue in assignment

_________________
SubSpace Discretion: A Third Generation SubSpace Client
Back to top
View users profile Send private message Add User to Ignore List AIM Address
JoWie
Server Help Squatter


Gender:Gender:Male
Joined: Feb 25 2004
Posts: 215
Offline

PostPosted: Sat Aug 08, 2009 3:12 am    Post subject: Reply to topic Reply with quote

Code: Show/Hide

void swap(int* a, int* b)
{
   a != b && (*a ^= (*b ^= (*a ^= *b)));
}


The only problem with this code, incase you haven't noticed, is that there aren't enough Sequence points. So it has a wrong answer on some compilers
Back to top
View users profile Send private message Add User to Ignore List
Bak
?ls -s
0 in


Age:24
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Sat Aug 08, 2009 11:48 am    Post subject: Reply to topic Reply with quote

good enough
Back to top
View users profile Send private message Add User to Ignore List AIM Address
yn
Guest


Offline

PostPosted: Wed Aug 12, 2009 1:42 pm    Post subject: Reply to topic Reply with quote

Zero semicolons

void swap(int *a, int *b)
{
#define fi i##f
fi (*a != *b) fi (*b = (*b ^ *a)) fi (*a = (*b ^ *a)) fi (*b = (*b ^ *a)) {}
}
Back to top
Bak
?ls -s
0 in


Age:24
Gender:Gender:Male
Joined: Jun 11 2004
Posts: 1826
Location: USA
Offline

PostPosted: Wed Aug 12, 2009 8:49 pm    Post subject: Reply to topic Reply with quote

orly
Back to top
View users profile Send private message Add User to Ignore List AIM Address
yn
Guest


Offline

PostPosted: Thu Aug 13, 2009 3:14 am    Post subject: Reply to topic Reply with quote

yarly
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Non-Subspace Related Coding All times are GMT - 5 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 411 page(s) served in previous 5 minutes.

phpBB Created this page in 0.549501 seconds : 31 queries executed (75.8%): GZIP compression disabled