473,396 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to read confusing execution code under IF condition

1
Hi - I'm completely new to C and trying to read some code that doesn't make sense to me. For proprietary reasons I can't display the code here but I'll describe it...and list part of it in a generic form below. I know the basics about IF conditions and have read plenty of them without difficulty but this one is really confusing me.

There is a long, complicated IF condition (1 AND and 2 ORS, with 2 parts to each OR and 2 NOTs!), then a list of code to execute if the IF condition is true, under it.

The execution code looks like this:

output = variable x
variable y = output
variable z [0] = output
variable z [1] = variable [0]

I am very confused. This is part of a continuous simulation block and variables x and y are different inputs to the block, which cannot possibly be the same and (when I tested it) are not forced to be equal to the same value, yet both are said to be equal to the output, which can be only one value. The block runs without glitches so I don't think it's an error in the code. Could someone please explain to me how to read this code? It doesn't make any sense to me but it must be just something I don't know about IF conditions or ignorance of some sort. I'm wondering if the first line is executed during the first time step in the simulation, then the next line during the next time step,or something...

Also, the last 2 lines above...what does this mean? I know about arrays and assume that this has to do with values at different time steps...value 0 is defined at one step, then value 1 is defined at the next step, etc. but I don't get what this code is saying.

Any help would be much appreciated. Thank you so much!
Nov 10 '08 #1
2 1411
JosAH
11,448 Expert 8TB
Better show the actual expression because I don't understand anything from your
description. Feel free to change variable names at will as long as the semantics
of your posted expression are the same as the one you're looking at.

kind regards,

Jos
Nov 10 '08 #2
donbock
2,426 Expert 2GB
Please also provide the declarations for the variables. For example, perhaps "output" is a pointer to a memory-mapped input port. If so, then you might get a different value each time you read it.

Another issue is to understand what it means in your application domain to take this branch of the if-statement. Perhaps that complicated boolean expression amounts to a corner case where it is necessary to initialize the simulation variables.
Nov 10 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Rajarshi Guha | last post by:
Hi, I'm writing some code using PyGTK2 that uses inpu_add_full() to watch a socket. I've included the code below. I have two questions: 1) What does a condition == 16 mean? It does match any of...
5
by: Boris Nikolaevich | last post by:
This is backwards of what I usually want--normally if you have a long-running ASP script, it's a good idea to check to see whether the client is still connected so you can cancel execution. ...
2
by: Gunnar | last post by:
Hello, I've just written a CPP program that reads integers from a binary file, and used this code while (my_ifstram.read( (char* ) &number, sizeof(int)) { // do something with number } My...
2
by: David McBride | last post by:
I'm getting the following message when I run my Perl script that uses the XML::Writer module: "Processing instruction target begins with 'xml' at .../makeconf/LW/LWTest.pm line 75" The pi()...
2
by: smauldin | last post by:
Why does the execution plan have a nested loop join for a simple select with an UDF in the where clause? Here is the query: select * from test_plan where vCol = my_udf('test') Here is the...
7
by: Naren | last post by:
Hello All, Can any one help me in this file read problem. #include <stdio.h> int main() {
7
by: kk | last post by:
Hi all, How to write a c/c++ program to execute limited number of times. if anybody know plz give reply. thanks
12
by: Yash | last post by:
My SQL query is like: SELECT ..... FROM tblCLAIM C INNER join tblXXX .... INNER join tblYYY ....(5 more joins) WHERE C.created_date between @start_date and @end_date AND...
4
by: sphinney | last post by:
Hi everyone. I'm creating an application inside Access 2007. The application will retrieve data from various locations on my company's network servers. Depending on the time of day, alignment of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.