ATTENTIONThis FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices. |
flexsim.com |
#1
|
||||
|
||||
initializing int in 4_3 and 4_5
Hi there,
I just pulled up a modell from 4_3 to 4_5. I found that if you define a integer in 4_3 like: int i_count; it was set automatically to 0. In 4_5 you have to set the varaible manually to 0 (initialize it): int i_count=0; Attached is a small modell which will work in 4_3 but not in 4_5 until you set the int to 0 when it is defined. What is the reason for this behavior?
__________________
kind regards Nico. |
The Following User Says Thank You to Nico Zahn For This Useful Post: | ||
Jörg Vogel (11-10-2009) |
#2
|
||||
|
||||
The reason for the change is mainly for conformance with c++. In c++ the variable is not initialized unless you initialize it explicitly, and right now the methodology in developing flexscript is to make flexscript act as much like c++ as possible, so that switching between flexscript and c++ is seamless, i.e. if you write code in flexscript, you can switch it to c++ and get the exact same results.
|
The Following 3 Users Say Thank You to Anthony Johnson For This Useful Post: | ||
RalfGruber (11-10-2009) |
#3
|
||||
|
||||
Hi Anthony,
are there some more changes which are not direcly listed in the change history of Flexsim 4_52?
__________________
kind regards Nico. |
The Following User Says Thank You to Nico Zahn For This Useful Post: | ||
RalfGruber (11-10-2009) |