Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: C++
Expertise: Beginner
Aug 14, 2000

Differences in Execution Flow

Question:
Why would a program not yield any errors, and yet not run on one system, while resulting in a perfect run (unchanged) on another system? Specifically, a switch statement was completely ignored on my system, yet functioned accurately on my professor's.

Answer:
Yes, it's possible to have the same program behave differently on different machines. There could be many reasons for this. For example, if the program is implicitly linked with certain runtime libraries (or DLL's) that are not identical on both machines, the same program can exhibit different behavior when it executes on different machines.

Likewise, certain applications access environment variables that might differ from one machine to another. An example of such a variable can be "IP_ADDRESS" or even USER. Since the values of these variables can be different on each machine, the result of a conditional statement that checks their values can also differ.

Finally, the code can be run by different users, who have different privileges. These privileges can affect the program's execution flow, too. Suppose the program tries to read a file. If a user with insufficient privileges attempts to execute the program from her account, the program will not be able to open the file, while a user with sufficient privileges can execute the program and have it open that file successfully.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap