The Increment and Decrement Operators (++ and - - )

Hi all !
Even if i do understand how ++ and -- operators works fine (as a pre-modifers and post-modifers) but i can't understand how do they got the HIGHTEST precedence (unary operators) over than other operators , consider the follwing examples :
Ex(1):
======
initially : x = 5 & y = 0;
y = x++ ;
i know the process goes like this :
- Evaluation : Left-to-Right (y is 0 and x is 5)
- Operation : assignement of x to y , then increment x by 1.
Q(1) is : why do assignment first then increment even if operator ++ has higher precendence than "=" operator.
(i understand that that is true if y=++x, but why? ).
Ex(2):
======
initially : x=5 & y =0;
y = x++ + 5;
y now is 10 , x now is 6
Q(2) is : even if the ++ operator is higher in precedence ,the arithmetic operator "+" is evaluated first, why?
(same applies to the -- operator)
Thanks ...

Q(1) is : why do assignment first then increment even
if operator ++ has higher precendence than "="
operator.
(i understand that that is true if y=++x, but why? ).The assignment is not performed first:
(1) Memory is reserved to store the result of the expression on the right hand side.
(2) The expression evaluates to the current value of x, which is 5. This value is stored away.
(3) x is incremented, and is now equal to 6.
(4) The value previously stored away is assigned to y. y is now 5.
Q(2) is : even if the ++ operator is higher in
precedence ,the arithmetic operator "+" is evaluated
first, why?The + operator is not evaluated first:
(1) Memory is reserved to store the result of the expression on the right hand side.
(2) The current value of x is stored in that reserved memory. The value is 5.
(3) x is incremented to 6.
(4) 5 is added to the expression result, and the result is now 10.
(5) The expression result is assigned to y. y is now 10.
Note that the implementation is free to perform the calculation however it wishes, so long as it is done such that the user/programmer can not tell the difference.

Similar Messages

  • With Traditional NI-DAQ Compatibility VI's the acquisition locks when I press the increment or decrement button of a numeric control.

    Hello all.
    I´m using a PCI-6220 and the Traditional NI-DAQ Compatibility VI's to make the acquisition that is in the attached VI. But when I click the increment/decrement button on the numeric controls my acquisition stops. In the same PC I made the same experience with a 6040 and I could not see this problem. I tried with the PCI-6220 with the DaqMX VI's and I could not see this problem too, for these reasons I believe that the problem has something to do with the Traditional NI-DAQ Compatibility VI's.
    I built machines that can have one or the other board (depending if it is low-end or normal). Does somebody knows the solution for this problem?
    Thanks in advance.
    Paulo Carmo
    Attachments:
    experiencia.vi ‏49 KB

    Hello
    For what I’ve seen on National web site, using the “Traditional compatibility VI’s”, it sould be possible to control a NI-DAQmx using code written in NI-DAQ Traditional. This information was obtained from the following NI link:
    http://digital.ni.com/softlib.nsf/954feaeea92d90918625674b00658b83/9d67f671bcc6850586256e630059308b?...
    Please read this information and then tell me something please.
    Best regards!

  • The acquisition locks when I press the increment or decrement button of a numeric control

    Hello all.
    I´m using a PCI-6220 and the Traditional NI-DAQ Compatibility VI's to make the acquisition that is in the attached VI. But when I click the increment/decrement button on the numeric controls my acquisition stops. In the same PC I made the same experience with a 6040 and I could not see this problem. I tried with the PCI-6220 with the DaqMX VI's and I could not see this problem too, for these reasons I believe that the problem has something to do with the Traditional NI-DAQ Compatibility VI's.
    I built machines that can have one or the other board (depending if it is low-end or normal). Does somebody knows the solution for this problem?
    Thanks in advance.
    Paulo Carmo
    Attachments:
    experiencia.vi ‏49 KB

    Hello
    For what I’ve seen on National web site, using the “Traditional compatibility VI’s”, it sould be possible to control a NI-DAQmx using code written in NI-DAQ Traditional. This information was obtained from the following NI link:
    http://digital.ni.com/softlib.nsf/954feaeea92d90918625674b00658b83/9d67f671bcc6850586256e630059308b?...
    Please read this information and then tell me something please.
    Best regards!

  • Increment and decrement buttons on a ring control are greyed out

    Hello,
      The check box for showing the increment and decrement buttons on a ring control are greyed out. Does anyone know why? I have verified that the ring is a control as opposed to a indicator.
    Regards,
    Kaspar
    Regards,
    Kaspar

    "the controls are greyed out because they do not exist on the Menu ring control."
    Errr... yes, I believe that's exactly what I said in my last response.
    "This is different from what I saw in another part of this forum about using event structures on a Menu ring."
    Don't know what you could be referring to, as there is no event specific to the increment/decrement controls. All that they would do (if they existed) is to change the value of the control, and the applicable event would be the "Value changed" event. Where exactly did you read this?

  • Programatically Accessing the Increment & Decrement of a Slide Control.

    Does anyone know if its possible to change the Increment and/or Decrement buttons in a Slide control? I know I can do this through the property pages but I can't find a method or property in the CNiImage class to gain access to these "buttons".
    Basically I have a 3D Horizontal Fill Slide and want to make the rounded ends flash when the value is under or over range and I can't find a way of doing it.

    Take a look at the CNiSlide::Images method. The documentation describes how you can access a CNiImage that corresponds to parts of the slide, including the increment and decrement buttons. Once you have the CNiImage for the buttons, you can configure the animation, blinking, etc. For example:
    CNiImage image = m_slide.Images(_T("Increment Button"));
    image.BlinkInterval = CNiImage::SpeedVeryFast;
    - Elton

  • Increment and Save command

    The "Increment and Save" command in After Effects serves the fundamental need in professional creative work of preserving the various development stages of a job. Cinema 4D and other pro software packages also have this. Illustrator should too.

    Autosaviour Pro auto saves your Adobe Illustrator artwork
    and they have incremental backups.

  • The plus(+) and minus(-) keys to increment or decrement the date

    Hi All,
    I have a date field in which I would like to have the + and - keys to increment or decrement the date as in some windows programs.
    Thank you, Bill

    Hi Chad, Yes I know the Date Picker... that is what it has now.
    My users are keyboard users... hitting the plus or minus sign in the Num Pad is much quicker if the date is only 2-3 day plus or minus...
    We desire to have the Date Picker and have maybe a onkey event call. I was hoping to find someone that has used "onkey" for a specific element/field so it doesn't look at every key stroke in the document but just the one date element onkeyup etc......
    Thanks for the response.
    Bill

  • Is Increment and Decrement Operators Atomic?

    Is there a need to synchronize increment and decrement operations, or they are atomic? If so, how about pre and post variations?

    raychen wrote:
    jverd wrote:
    Simple rule: If multiple threads are accessing a variable, all access to that variable must be synchronized. There are exceptions, but you'll seldom go wrong by following that rule.I don't synchronize data member accesses in simple setters and getters, as JVM guarantees my read and write are atomic at the memory level. Am I making bad assumptions?Yup, you are. For a couple of reasons.
    1. Reading and writing of non-volatile longs and doubles is not guaranteed atomic.
    2. It also does NOT guarantee that one thread will ever even see a value written by another thread, however, unless either a) the variable is volatile, in which case threads don't have local copies all reads and writes go against the main copy, or b) access is synchronized and therefore the writing thread's local copy is flushed to main memory upon exiting exiting the sync block and the reading thread gets its first read after entering the sync block from the main copy.
    Edited by: jverd on Jul 21, 2009 10:33 AM

  • Increment the version and current date in .ver file

    Hi All,
    I have the version.ver file and it looks like
    [version]
    BuildDates=2014.10.01
    Script=01
    MainVersion=1.00.00.00:01
    I want to increment the values and current date if i trigger the build using batch script. The output i need is like this
    BuildDates=yy.mm.dd (current date)
    Script=02
    MainVersion=1.00.00.00:02
    Thanks in advance

    Thanks for your reply. This is my script
    @echo off>newfile&setlocal enabledelayedexpansion
    :: set up your date here. It probably won't match my format so you'll need to adapt:
    set dt=%date:~10,4%.%date:~7,2%.%date:~4,2%
    for /f "skip=2 tokens=2,3 delims==:" %%a in ("filename") do (
    set v= %%b
    set v= !v: 0=!
    set /a v+=1
    set v=0!v!
    set v=!v:~-2!
    >>newfile echo SCRIPT=!v!
    >>newfile echo BuildDates=%dt%
    >>newfile echo MajorVersion=%%a:!v!
    goto :aa
    :aa
    more +3 "filename" >> newfile
    del "filename"
    ren newfile "filename"
    Before execute the script my file will be look like:
    version]
    BuildDates=date
    Script=09
    MainVersion=3.00.00.00:09
    after executing i am getting the output value as
    BuildDates=date
    Script=01
    MainVersion=19:01
    MainVersion=3.00.00.00:09

  • Exporting and importing only the Incremental datas

    Dear all,
    we r facing a big time consuming process of changing oracle schema datas from live servers to out testing servers..
    scenario as follows:
    1. .dmp files of size 1GB to 3 GB are taken from live server and posted in test servers to check the live issues
    2. same sized dumps are taken for simulation to rectify issue
    this type of above process consumes the whole time for exporting and importing
    can any one suggest me how can the incremental data's alone can be exported and imported to the test server.
    Hoping that i can get a valuable solution for this
    Thanks in Advance
    S.Aravind

    Hi Aravind,
    as Nicolas specified RMAN would be the best option.
    Incremental data refresh is not possible through exp/imp. but there is a possiblity of writing a script which automates this refresh process.

  • Numeric Format with "dB" causes strange Increment and Decrement behavior

    To reproduce this, drop a numeric control in LabVIEW (Version 8.2 and later).
    Right click on the numeric control and select properties
    Select the "Format and Precision" tab
    Select the "Advanced editing mode" radio button
    Change the Format string to "%#_gdB" and press OK.
    Type "-123" into the numeric control.
    Place the cursor inbetween the 2 and 3.  Press the up arrow.  The normal response of the numeric is to increment the number to the left of the cursor, in this case the 2.  The expected number is -113.  However, with the "dB" in the format string, the number becomes -11.3.  This caused a problem with a Signal Generator whose power output (in Decibels) was controlled by this instrument.  in 2 keystrokes, the power went from -80dB to 0dB and almost damaged some equipment.
    The work around is to remove the dB from the format string or put it in parenthesis.  However, this seems like a bug.  If someone from National Instruments determines this is a bug, please post the CAR# to this thread.  Otherwise, it would be nice to have this behavior explained.

    Interesting behavior. I confirmed this with 8.2. What's more interesting is that the behavior is not consistent. If you use "Hz" the control works as you expected it to work. If you use "A", and perform the same steps, pressing the up arrow gets you "NaN". I tried putting a space before the "dB", and it made no difference. At first I thought that the "d" was being misinterpreted, but the result from using "A" made no sense. Very odd.
    Lesson learned from your experience: Always make sure to check the values that you want to set before you actually set them. You should have 2 layers of checking. The lowest level checks the values against the instrument's capabilities. In other words, making sure you don't try to program a level of 100 when the instrument can only handle 10. A higher level should check values against usage limits. This is where you put in the valid ranges for how you're using the instrument. For example, even though the instrument may be able to go to 13 dBm, in your testing you may only want a maximum setting of, say, -20 dBm. In my code I write a wrapper VI around each driver function to implement this. This requires extra code, but it can save your butt in many instances.

  • Increment and decrement with a Boolean input

    Hello Labview Experts (and life savers actually !!)
    In my VI ,I have  a numerical controller (knob) feeding a numerical indicator ,in addition to a bolean input.
    As an initial state the numerical indicator will contain a certain value (zero for example) and will only receive the variation in the knob input as long as the bolean input is true and then add it to this initial value.
    what is the variation ? lets say that the knob was on 8 before i hit the boolean true ,the indicator's value is zero ,and then I hit the boolean true ,
    Now ,when i move the knob from 8 to 18 (+10 variation) ,I want the indicator to receive +10 and add it to the zero ,now the result is 0+10=10.
    Now the boolean is false ,I move the knob and nothing happens to the 10 in the indicator.
    Now the boolean is true again ,let's to say the knob was on 4 at the time i hit the boolean true ,and I move it from 4 to 1 (-3 variation) ,the indicator's value now will be 10+ (-3) = 7
    I hope I explained the idea in a clear way ,I would be very thankful if someone would help me with that.
    P.S. I only attached the vi for illustrating the idea.
    Thanks in advance
    Solved!
    Go to Solution.
    Attachments:
    main components.vi ‏7 KB

    You only care about how much the knob changed.  Therefore, you need to subtract the old value and the new value to get how much the knob changed.  Then inside the case structure, add that difference to your value that belongs in the shift register.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Incremental_BD.png ‏7 KB

  • How can I use two single-dimensional arrays-one for the titles and array

    I want to Use two single-dimensional arrays-one for the titles and one for the ID
    Could everyone help me how can i write the code for it?
    Flower
    public class Video
    public static void main(String[] args) throws Exception
    int[][] ID =
    { {145,147,148},
    {146,149, 150} };
    String[][] Titles=
    { {"Barney","True Grit","The night before Christmas"},
    {"Lalla", "Jacke Chan", "Metal"} };
    int x, y;
    int r, c;
    System.out.println("List before Sort");
    for(c =0; c< 3; ++c)
    for(r=0; r< 3; ++ r)
    System.out.println("ID:" + ID[c][r]+ "\tTitle: " + Titles[c][r]);
    System.out.println("\nAfter Sort:");
    for(c =0; c< 3; ++c)
    for(r=0; r< 3; ++ r)
    System.out.println("ID:" + ID[c][r]+ "\tTitle: " + Titles[c][r]);

    This is one of the most bizarre questions I have seen here:
    public class Video
    public static void main(String[] args) throws Exception
    int[] ID = {145,147,148, 146,149, 150};
    String[] Titles= {"Barney","True Grit","The night before Christmas", "Lalla", "Jacke Chan", "Metal"};
    System.out.println("List before Sort");
    for(int i = 0; i < Titles.length; i++)
       System.out.println("ID:" + ID[i]+ "\tTitle: " + Titles);
    System.out.println("\nAfter Sort:");
    for(int i = 0; c < Titles.length; i++)
    System.out.println("ID:" + ID[i]+ "\tTitle: " + Titles[i]);
    Generally you don't use prefix (++c) operators in you for loop. Use postfix (c++).
    Prefix means that it will increment the variable before the loop body is executed. Postfix will cause it to increment after.

  • The DOs and DON'Ts of ICS

    Written by:  Sumit Jain  After working extensively on Informatica Cloud, I have collected some to dos and guidelines of the Informatica Cloud product. You may know them before hand, but I thought to compile a list and share it with a wider audience:  1. Create a Naming Conventions document detailing the standard naming conventions for different types of Connections, Tasks, Taskflows and schedules within Informatica Cloud. All the developers should rigorously follow these naming conventions. It has been observed that when multiple people are working simultaneously, they tend to follow their own naming standards and at the end, there are lot of tasks and it is very difficult to identify tasks and administrator has to spend a good amount of time identifying the correct tasks.   2. Add meaningful description to all your tasks, connections, taskflows and schedules in such a way that they convey the purpose of their use and thus do not create confusion to other users.   3. The machine the Informatica Cloud Secure Agent runs on must always be on. It must not be in a sleep mode or in “idle”. This might be indicated when the Agent status fluctuates between an active/inactive state. Make sure this computer is on or re-install the agent on a computer that stays on continuously.   4. If you are using the CSV files as source or target, make sure that you match up the date format in the associated connection for flat files, by dropping down the Date Format list and choosing the matching format. And If there isn’t a matching format in the drop down list, then you will need to explicitly format the date in Step 5 of Data Synchronization task by using a transformation function called TO_DATE.   5. If there is a requirement of performing a lookup on Salesforce objects, then do not create a direct lookup. A direct lookup on Salesforce object will call the Salesforce object for each record processed and thus performance will decrease considerably. Instead, write the data of Salesforce object in a flat file and then use the flat file for doing the lookup.    6. For incremental processing, use the “$LastRunTime” and “$LastRunDate” variables in conjunction with a source field of “date” type. Informatica Cloud supports and maintains these variables automatically. For example, if your source has a field called LASTMODIFIEDDATE, you could set up your filter such that LASTMODIFIEDDATE > $LastRunTime. If your schedule then runs the task on a daily basis, that means each day you will only have to deal with the new/changed records from the previous day, instead of worrying about ALL records.   7. If the Informatica Cloud Secure Agent is running on a linux or unix server, it will not support MS SQL Server as source or target.   8. In a multi-user environment where the number of tasks to be created is very high, create Views based on logical groups for viewing similar group task in a single task view. Similarly you can create views for connection and taskflows.   9. SYSDATE is the current datetime you can use to denote the current date and time.   10. Use logical operators like IIF and DECODE to encode conditional logic in the expression in Step 5 of Data Synchronization task.  This has been posted on the community page as well. https://community.informatica.com/docs/DOC-3772 What are some of your best practices? Please share with us on the comment section below. Thanks!

    Overview In part 1 of this series, I discussed why I thought that the new app platform from Salesforce.com ("Salesforce 1") was far from perfect and described this as "the App Gap". Sure, Salesforce 1 is a vastly improved mobile experience for every Salesforce user, but it still provides no help in two crucial areas.  Namely:There is no ability for business users to quickly deploy mobile apps by themselves.There is no automation to help users efficiently complete more than one salesforce activity at a time.   I also explained in part 1 that these shortcomings can be easily addressed by adding Informatica Cloud Extend to any Salesforce 1 implementation.  So for the  remainder of this article I'll explain how to configure your Salesforce org to leverage Informatica Cloud Extend.  Then you'll be closing the Salesforce 1 'App Gap' in no time.  Step 1. Modify VisualForce Launch Pages  It turns out that Informatica Cloud Extend guides can run easily from Salesforce 1. This is because Salesforce 1 now lets the user navigate to an object within the mobile app, and then the user can run a Cloud Extend guide from that object. But in order to get a Cloud Extend guide to run in Salesforce 1, the VisualForce page for launching CE guides must be modified first. VisualForce pages have an option for “Available for Salesforce mobile apps”:  So check that option. Step 2. Replace 'Managed' Cloud Extend VisualForce Pages  The VisualForce pages for standard Salesforce objects are part of the Cloud Extend managed package, so users cannot edit them (we manage these pages in order to improve your Cloud Extend experience.  In addition we also update them as needed with new Cloud Extend releases).  However that doesn't mean that can't replace the relevant VisualForce pages. So that's what we're going to do.  The doc on how to do so is here:   http://help.cloudextend.com/salesforce/documentation/#UserGuide/AdministeringCloudExtend/CustomizingStandardPages.htm So for  our example, let's replace the Opportunities VisualForce page.   Below is an screenshot of an example replacement VisualForce page: The VisualForce markup for the page is:  <apex:page standardController="Opportunity">    <ce4sf20_001:AeSalesGuides objectType="Opportunity"  objectId="{!Opportunity.Id}"  extraInfo="{!JSENCODE(Opportunity.Name)}  ({!JSENCODE(Opportunity.Account.Name)})"/>                  </apex:page>  To replace this page, I first went to the Opportunity screen layout editor and removed the existing VisualForce page for Cloud Extend guides.  Then I replaced it with the “mobile-enabled” VisualForce page that I just created.  Step 3. Testing that it Works!  The final step is to test that it works.  So now open the Salesforce 1 app and navigate to an Opportunity object:  The Cloud Extend guide launcher appears (I only had the “Update Selected Opportunity” guide published for smartphones.  If there were other Cloud Extend mobile guides published for Opportunities, they would have also appeared in this list). Next I click the “Update Selected Opportunity” and a new window within Salesforce 1 launches: Clicking on the Cloud Extend "Update Selected Opportunity" guide again starts the guide running: When the guide finished, I clicked the arrow in the top left of Salesforce 1 to take me back to the Opportunity object that first initiated the Cloud Extend guide. So there you have it!  A a quick way to integrate Informatica Cloud Extend working in the new Salesforce 1 application. Of course there may be other ways to integrate Cloud Extend into Salesforce 1 and we will certainly be looking at those options going forward.

  • When I resize the font for the Page Labels on the tab control in LabVIEW 7, the Increment/Decrement size gets messed up. Is there a solution to this problem or is this a bug?

    I have noticed in LabVIEW 7.0 and 7.1 that when the text in the page labels display is enlarged, that the arrows enlarge but the top arrow enlarges more then the small arrow but then when you decrease the text size, the arrows stay remain large. This is not a problem in 6.1 because the arrows aren't available. Is there a work around for this bug or do I have to use small text for these page label arrows to look right?

    I must admit that I've never used the page labels display and it does look like a bug. You can fix it however. Select the tab control and choose Advanced>Customize. In the control editor, select the page label control and do the same thing. You should be in the control editor for the numeric control and then you can go to edit mode and enlarge the decrement arrow to make it the same size as the increment.

Maybe you are looking for

  • Adding logic to the hide/show

    Hi Guys I am pretty new at this so please excuse my ignorance. I have added hide/show regions into a cell of an advanced table. In the VO I also coded in the boolean decode. So now when I run my page I get the the following: where there is details fo

  • Still in a quandary about hardware specs. What do you think?

    I need to build a new system as editing machine for CS4. Everything is more or less clear as to what I need, there are only two issues remaining: 1. How much RAM to install, and 2. Disk setup. As always there is the balance between performance and co

  • Regarding RFC creation

    hi all, after creation of RFC,we have to release the RFC or not. regards, subba reddy

  • Beginners Question - cluster config

    Hi, Is it possible to configure three Sun E10000 nodes in a cluster so that the first 2 nodes will be in scalable mode with dynamic load balancing and and the third in failover mode?. The application running is a web server with Oracle databse at the

  • Is there any way i can keep pages documents and numbers documents in the same file?

    Im trying to group pages and numbers documents in the same file is this possible?