Go to Post [Programming a swerve drive] It's really really simple, unless you actually do it. - Ether [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Spotlight this post!  
Unread 26-01-2005, 19:44
Workaphobia Workaphobia is offline
Registered User
AKA: Jon
FRC #1546 (Chaos Inc.)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Long Island
Posts: 26
Workaphobia will become famous soon enough
Re: Weird problem with if statements

In C/C++, it is common for mutators to have return values, so that you can cascade (is that the right word?) operations. For example,
a = b = c
works because the assignment operator is right-associative. It is read in as a = (b = c), then b = c is evaluated first, and its return value is plugged into a = <that>. If the expression b = c didn't return anything, you'd have a = <void> and the compiler would generate an error.

This is why a number of C library functions return a pointer to a buffer argument. For example, strcpy (that is, string copy), which takes in a destination memory address and a source address, returns the destination pointer when it's done copying. This allows you to do something with the return instead of just sticking it by itself in a statement and putting a semicolon after it.

Combining expressions in this way can make your code a bit more difficult to read, which is probably why Java doesn't support this style that well.
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming Problem: Extremely Frustrating chantilly_team Programming 19 12-02-2005 23:00
Physics Problem Venkatesh Math and Science 13 30-11-2004 20:30
Weird Output from Dashboard Port Ian W. Programming 9 06-03-2004 21:33
The problem with scouting... archiver 2001 10 23-06-2002 23:49
Major problem with chipphua motors aka Scott White Motors 18 19-03-2002 19:44


All times are GMT -5. The time now is 04:39.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi