Behavior of overflowing integers. [particularly C]

Is the behavior of overflowing integers (of any size) standard across platforms? What exactly happens if I overfill or oversubtract unsigned integers? I'm asking this because I'm writing an emulator which may encounter arithmetic situations where this may occur.

Xyne wrote:
kazuo wrote:ISO C99 says that overflow are "undefined behavior" i.e. anything can happen and its ok. Wrap around? OK Program abort? OK, Pregnant cat? OK.
Good thing it only applies to cats and not humans, otherwise bad programmers all over the world would have to have this conversation:
Girl: Are you sure it will be ok?
Guy: Don't worry, I know what I'm doing... my integers never overflow. Just relax and trust me.
Lol!! Hahaha
@Anikom15 You can get the needed info on google, this is a very common topic (its is a FAQ at comp.lang.c FAQ). For example look at http://www.fefe.de/intof.html
EDIT, now re-reading your last message looks like you question now is in a more general sense. You can look at something like http://en.wikipedia.org/wiki/Arbitrary- … arithmetic , but the final solution (bignum, or safe overflow, using bigger types) is per case basis. For example, if you know that you are limited to 64bit sizes you can use it (simple use a 64 bit type) if the needed type is not available you can create then (using for example two smaller types), as I said all depends of the user case.
Last edited by kazuo (2010-06-14 00:40:10)

Similar Messages

  • Strange Port behavior

    Hi there,
    I have a situation where I'm trying to run a subversion server using the built in svn protocol on my Mac Mini. I want to make the subversion repositories available to the internet. However, I cannot use my domain name to access the svn port.
    My router uses the Mini as the DMZ server so all ports get forwarded to the mini. My IP address which is mapped to my domain name, does hit apache and tomcat. They work fine.
    However, I cannot see port 3690 from my domain name. The svnserver IS listening though, because I see it in the netstat listing. AND I can hit the subversion server if I use the bonjour name for the machine BUT NOT if I use my domain name.
    This shows up with a simple port scan. For port 80 (or 8080), I can see the open port if I scan against: My Domain Name, the WAN IP of my router, the LAN IP of the router, or the bonjour name (cooper.local)
    On the other hand, a port scan for port 3690, shows an open port for: my LAN IP of the Router, and the Bonjour name. BUT NOT for either my Domain Name or my WAN IP.
    This seems like a mis-feature. Does anyone know how to make the port visible beyond my subnet?
    I've tried explicitly adding the port to the router, without any luck. I don't think the problem is in the router. It seems to be special behavior for this one particular service.
    Thanks,
    John Schank

    Hey Matt,
    Thanks for the suggestion...
    I tried a different port, and still the same behavior. (I tried 8888, as well as a port < 1000) No difference. This is truly magical, somehow, it seems, that the way subversion creates a listener socket is immune to port forwarding. Perhaps I should ask the inverse question? Suppose I wanted to have a service that could not be used via a port forwarding router, only on the local subnet... How would I do that? Maybe the answer to that question would be a clue.
    Thanks again,
    John

  • What is the correct way to add behaviors to text?

    I seem to be having trouble adding behaviors properly.
    What I'd like to do is select a few words of text and apply a behavior to them, in particular the behavior Open Browser Window when a user clicks on the selected text. I've gotten this work in what I'm sure is not the correct way. The only way I can get it to work is if the text link also has an a href link set up (through the Properties Inspector) pointing back to this same page. Now if I simply select some text and go to add a behavior to it through the tag inspector panel a lot of my choices are greyed out. I'm not super code-savy but do I understand that these behaviors should / can only be applied to tags? 
    You can see samples of what I'm talking about here: http://www.philasecurities.com/luncheon_meetings.html. In the luncheon schedule, click on the "more…" links and a new, small browser window should open. 
    How should I be applying these correctly?
    Thanks,
    John

    Pop-up Window in Dreamweaver (Behaviors Panel)
    1.  Insert an image or type some text.
    2.  Select it and go to the Properties Panel link field.  Browse for the file or type the full URL (http://example.com).
    3.  Go to the Behaviors Panel and hit the plus sign to add a new behavior.
    4.  Select Open Browser Window.
    5.  Browse to file or type the URL (Yes, a 2nd time).
    6.  Set the height, width and other optional attributes for your pop-up window. (See link below for details)
    http://help.adobe.com/en_US/dreamweaver/cs/using/WSc78c5058ca073340dcda9110b1f693f21-7b07a .html
    7.  Hit OK.
    8.  Verify that the behavior's trigger event is onClick.  If it's not, click the event box to show other trigger options.
    9.  IMPORTANT!  Go back to the Properties Panel and replace the first URL in the link field with javascript:() which makes the primary link into a null link.  If you don't do this, the link will open twice: once in the pop-up window and again in the parent window.
    Save your page and preview in browsers.
    PS. It takes longer to explain all these steps than it does to do it.
    Nancy O.
    Alt-Web Design & Publishing
    Web | Graphics | Print | Media  Specialists 
    http://alt-web.com/
    http://twitter.com/altweb

  • Slow Initial ReportDocument.Load & Creation Of *.rptConMgrCache file

    Problem Description
    We have a .NET reporting application that utilizes CrystalReports (assembly version 12.0.2000.840) to render about 10 different reports. When loading a particular report template (*.rpt) using ReportDocument.Load, we have noticed that the initial load takes approximately 2-3 minutes. All subsequent loads of the same template take a fraction of a second.
    The strange thing is that this behavior only occurs on particular servers (all servers in our environment are Windows 2003). On the servers with the 2-3 minute initial load, a *.rptConMgrCache file is created during the initial load and deleted when the operation is completed. On the servers that don't have that issue, the initial load is about 10-15 seconds at worst and no *.rptConMgrCache file is created.
    Initial Load in this scenario refers to the first call to the ReportDocument.Load function after IIS has been reset. This delay on the initial load is only encountered on one of the 10 report templates. The others load consistently on all servers without generating the *.rptConMgrCache file.
    Questions
    1. What is the *.rptConMgrCache file that is created in the C:\Windows\Temp directory on the problematic servers? Why would some servers create this file while others do not?
    2. Is there a resolution to this issue? I encountered this forum thread with the same issue, but the solution is for an older version of CrystalReports:
    [Re: Creating Rpt Conmgr Cache File In Temp folder while opening report from app|Re: Creating Rpt Conmgr Cache File In Temp folder while opening report from app]
    Environment Details
    - Windows 2003 Servers
    - .NET 3.5 Application developed with Visual Studio 2008
    - Packaged Crystal Report Assembly Version: 12.0.2000.840
    - Latest GAC Crystal Report Assembly Version (all servers): 12.0.2000.0
    - Kirti
    Edited by: KirtiRK on Oct 12, 2010 5:45 PM

    Ludek,
         From the other posts and articles that I have read, I completely understand that the first load is supposed to take longer because the runtime is being loaded. I should have been more clear in my original post, but this is basically what I see in terms of performance:
    Troublesome Report Document
    Initial Load
    Good Server   ~10s
    Bad Server      2-3minutes**
    2-3 Minutes covers the range of the worst loads we've seen. But you're right that I'm sensationalizing it a bit - most of the delays are right around 1minute.
    Subsequent Loads
    Good Server    <1s
    Bad Server      <1s
    All Other Report Documents
    Initial Load
    Good Server   ~10s
    Bad Server     ~10s
    Subsequent Loads
    Good Server  < 1s
    Bad Server    < 1s
    Differences in Report
    Other reports have subreports and we verified that all of our report properties match exactly. There are definetely some layout differences and I can dig in to see if there is anything odd.
    Differences in Modules
    The modified dates are somewhat different for many of the modules/assemblies, but most of them match up exactly with file size and version. I will dig in here as well to see if I can find any notable differences.
    Environment Factor
    In the end, the same code/document behaves differently on some servers. Given that information, I think that it might end up being an environmental issues - wheter that is with the Crystal Reports installation or some other .NET setting, etc. Other than the delay, the only concrete difference we've seen is the creation of the *.rtpConMgrCache file in the C:\Windows\Temp directory.
    What I'm Looking For
    To guide me in researching and drilling down further, I was hoping to find out more about what the *.rptConMgrCache files are and understand why they are created on initial load on one server and not on another. Unfortunetely, I was not able to find too much information about this on the net/forums.
    - Kirti

  • Outlook 2013: There is a problem with the proxy server's certificate

    Hello!
    One more question regarding Outlook 2013/Exchange2013SP1:
    There are three lab PCs: DC, Exch1, Exchange2. There's a wildcard certificate installed on Exch1 (https://social.technet.microsoft.com/Forums/en-US/6a440c99-47bd-4f48-8cc5-9f92e6b06496/wildcard-certificate-for-exchange-2013?forum=exchangesvrgeneral).
    OWA works perfect with this wildcard certificate.
    I install Outlook2013 on Exch1 and get the error:
    DC.Entreprise.Local is a computer certificate issued for the computer DC.Enterprise.Local.
    DC.Enterprise.Local IS NOT (and never was) the proxy for Exch1 or Exchange2:
    How Outlook could request DC's certificate if the proxy server = Exch1.Enterprise.Local???
    Thank you in advance,
    Michael

    Hello all,
    Thank you for your replies!
    Since I'm using a wildcard certificate I changed Outlook providers according to this:
    http://blogs.technet.com/b/exchange/archive/2013/08/02/part-2-reverse-proxy-for-exchange-server-2013-using-iis-arr.aspx
    If you do choose to use a wildcard certificate, you should also make sure that you
    change the EXPR Outlook Provider, so that Outlook Anywhere clients can successfully connect to the Exchange Server (this behavior can be a particular issue
    if you have Windows XP clients). If you do not make this change then end users may continue to receive a prompt for a certificate mismatch."
    ...and EXCH and EXPR are both set to *.Enterprise.Local.
    "I install Outlook2013 on Exch1" you mean you install Outlook on top of Exchange?"  - on the same server as Exchange, and in this case Outlook must use SCP, not DNS (the server and the client are in the same AD domain).
    "Without SCP, Exchange  try DNS autodiscover lookup, first site it will try is
    https://emaldomain/autodiscover/autodiscover.xml, which happen to be resolve to your domain controller."  - I think that's the case... I just don't understand why
    an internal client can't find the SCP that does exist and point to exch1.enterprise.local:
    Regards,
    Michael

  • Why is the kernel32.dll being included with my executable?

    It's actually being included in the support files folder with the other dll's necessary for the executable.&nbsp; It is not required for my executable, however, and when I put the executable on a computer outside of the development environment, the executable breaks when it runs.&nbsp; If I delete the kernel32.dll from the support folder, the executable runs fine on the stand alone computer.&nbsp; The frustrating thing about this is that this is new behavior for making this particular executable.&nbsp; My development computer started adding the kernel32.dll to my executables that contain a certain sub vi a couple of months ago.&nbsp; The offending sub vi has no library function calls to the dll that I can find or knowingly added. If I use a different development computer with the exact same source code and project file, the kernel32 dll is NOT included in the support folder.&nbsp; It is only my particular development computer.&nbsp; I looked at all the posts that contain a reference to the executables with kernel32.dll, like the one in the Knowledgebase "My Stand-Alone Executable Cannot Find My DLL, Even Though I Have Specified the Path for the DLL" and tried to add the system32 folder to the vi search path, but that did not do anything. I looked through all of the Options pages but did not find anything that seemed relevant.&nbsp; Did I miss some setting that I inadvertantly modified to start getting this behavior?
    &nbsp;
    Please let me know what I can look for to try and fix this problem.&nbsp; It is not an acceptable solution to have users go into the support folder and delete this file after the program is installed on their computer.&nbsp; It is also not reasonable for me to use a different computer each time I want to create an executable, and I really don't want to reinstall all of the many parts and modules of LV on my computer.
    &nbsp;
    Thanks,
    Craig

    Duplicate post

  • Lightroom 5.5 internal error and other issues

    Since upgrading to Lightroom 5 (I'm using 5.5 now), I've had all sorts of weird behavior and slow performance, particularly in the Library module. After heavy use in the Library, Lightroom starts to refuse to reorder, or add to collections, or it will open the wrong photo in Photoshop when I press Ctrl-E, all kinds of things. One day I couldn't quit by pressing Ctrl-Q; it would bring up the Export dialog box. Typically if I exit and restart, the problems go away for a time.
    Today, the latest is this:
    I've deleted the Preference files once, and I regularly optimize the catalog. Any clues where I could go from here?
    Windows 7 Home Premium, 64 bit.

    Do you have the 3G/4G mobile network active when you press the download button in the message? Whenever I had to download the attachments in a mms message, I did it while connected to the 3G network. The wifi connection had to be turned off or disconnected.
    HTH

  • Mouse pointer is possessed

    Here's one I can't find in the search function...I'm using a wired Mighty Mouse and once or twice a day the pointer just takes off on its own and goes to the upper right hand corner of the screen. Once there, I can pull it back down and it tracks just fine. Otherwise, it tracks normally. I've not been able to correlate this behavior to any one particular application. I'm on a nice mousepad and have no other control or tracking issues - just this one bit of flakyness.
    Any guesses?
    And thanks!

    If it seems to go about on its own, try going into System Preferences -> Mouse & Keyboard -> Mouse -> then lower the tracking speed a tad. What may be happening is that, since the wired Mighty Mouse is optical, the sensor may be tracking small movements that accompany a slightly shaking desk (from typing perhaps?) and then taking those tiny movements as you moving the mouse.
    Hope you get your mouse fixed soon!

  • Student Project - Need Help With ViewPlatform Rotation

    Hello folks,
    I'm a student in Strathclyde University, Glasgow, and I'm currently doing a small project for one of my programming classes. I'm doing a 3D knots and crosses game but I'm having tremendous difficulty getting the rotation to work just the way I want it to. Let me decribe what I need.
    Visualise 27 cubes, arranged in a 3 x 3 x 3 structure, space out slightly: a 3D knots and crosses setup. I'm trying to get the ViewPlatform to rotate around the central cube in a spherical fashion.
    I also need this rotation to use the keyboard arrow keys, not the mouse because I am reserving the mouse for interaction using the PickMouseBehavior class as stated in my project specification.
    I have looked up various classes in the API: such as KeyNavigator, OrbitBehavior, and some VisAd class that isn't included with the Java3D API nor is it on the systems I have available at the university.
    The trouble is, all these classes that I have found do not rotate the way I need them to: as described above. They "turn left" and "turn right" the camera as opposed to "rotate left around" and "rotate right around" the central cube (i.e horizontal rotation of the camera on a wide circle around an object).
    They also "move forward" and "move backward" as opposed to "rise up around" and "drop down around" the central cube (i.e. vertical rotation on a wide circle around an object).
    I have previously tackled this problem by creating a dummy cube under the central cube using then attaching the "camera" to the dummy cube in the DarkBASIC programming language and wonder if this method is available using Java.
    I've thought about defining my own arrow key rotation class, but I have little idea how to go about doing that either.
    An additional bonus would be the ability to limit vertical rotation so as not to go over and upside-down the vertical limit.
    Any help would be appreciated.

    I appreciate the answer and I know about implementing a Behavior to do this particular function of the program: is this what you are suggesting?
    If so, could you provide some clarity onto how go about implementing a Behavior to do the type of rotations I stated in my first post? By clarity I mean a little bit more about the recipe for creating a Behavior: the API is lacking documentation on this I think.
    I'll go do a bit of reading on it and tell you where I get. Nonetheless, any further advice would be much appreciated.

  • ICloud and Open Dialog boxes not working

    I originally posted a question at Open Dialog boxes have disappeared without results. I have some more information now.
    The problem: Open Dialog boxes do not work - they don't show up at all - for apps supported by iCloud. Apps that don't use iCloud work fine.
    I've now figured out that the Open Dialog boxes will reappear if I uncheck Documents and Data in the iCloud preferences pane. If I recheck it, then the Open Dialogs for all synced apps stop working. I am unable to correlate when this behavior started to any particular event on my Mac (that is not to say there is not a correlation - I simply can't find one). I have done file permission repairs, deleted com plists and even reinstalled Mountain Lion 10.8.2, all with no change in the behavior. The results of checking/unchecking the Documents and Data box are instant. I can have an app like Preview open or closed, or restart the computer. It does not matter. Checked = no Open Dialog; Unchecked = get Open Dialog (without iCloud option of course).

    I appreciate all responses particularly from an "Official Adobe" human being!
    Unfortunately, a significant amount of effort has been expended with no joy here.
    I have done the following;
    (1) examined every plug-in folder for duplicates - None found
    (2) deleted the symlinks (aliases) Topaz created referencing their plug-ins in /Library/Application Support
    (3) reinstalled the Topaz bundle - no change
    (4) Spoke at length with Topaz support and have been assured that all of their plug-ins are CS6 compatible.
    (5) Have had the same conversation with Nik regarding their 2 plug-ins - assured that they are compatible.
    Frankly I'm stumped here. I've combed my system in everyway I can without any change in PS behavior - on Open it defaults to blank and "Save as" selects the wrong format.
    Question for the experts. Would deleting PS completely and then reinstalling make a difference or am I now in uncharted territory and on my own?
    Thanks for all assistance,
    Robert
    Still need to save as TIFF but can't seem to get there.

  • IPhone Gmail bug

    If you add a new Gmail IMAP account using the "Gmail" logo option, you don't have the ability to change the behaviors of the "Sent Mail" from the Advanced Tab. However, if you add a Gmail IMAP account using the "Other" option, then you do have the option to change the behavior of "Sent Mail" from the Advanced Tab.

    The "bug" part is that if you include an IMAP Prefix and you don't have the option to set the "Sent Behavior," then any mail you compose will not be visible under "Sent Messages." It's puzzling why a creating a standard IMAP account gives you more advanced IMAP options than when creating a Gmail IMAP account on the iPhone. Also, if you sync your mail.app settings through iTunes, and mail.app has a Gmail account with an IMAP Prefix and specific "Sent Mail" behavior, none of these particulars get synced to the iPhone. Thus, you have to setup these Gmail particulars manually on the iPhone.

  • ODI Execute Button Acting Different than Right-Click - Execute in Diagram

    We have noticed that clicking the 'Green Arrow' Execute button in ODI to begin the Execution using First Step with only one Procedure is acting differently than simply right-clicking and selecting 'Execute' within the Diagram tab. We have noticed this issue with only a SQL Procedure.
    In other words, when clicking the 'Green Arrow', ODI compiles the package together before executing which seems to make the procedure execute differently than right-clicking and executing the procedure individually.
    Has anyone else noticed this issue?

    Executing with Green arrow means the entire package would be compiled and executed. In such case if you have any special configuration for that step then that would be effective and thus might show different behavior.
    Running a particular step by right clicking on it would be equivalent to running the procedure or interface directly.
    Do you see difference in behavior if you run the procedure directly v/s running it within package too?

  • I'm being blackmailed

    I was stupid enough to **bleep** on camera for somebody who I thought was friendly.
    She recorded the video and threatened to post it to Facebook for all of my friends and family to see.  I saw online here that this was a farse, but I feel really unsafe. What should I do?  She's asking for $350

    Hi, Jamez0784, and welcome to the Community,
    If you type the word "blackmail" in the search box, above, you will be presented with a long list of discussions (threads or topics) with peoples' like stories.  Please start by reviewing this FAQ article:
    https://support.skype.com/en/faq/FA34447/what-shou​ld-i-do-if-i-see-abusive-behavior-on-skype
    I particularly recommend posts by Community Contributor JonArbuckle.
    Regards,
    Elaine
    Was your question answered? Please click on the Accept as a Solution link so everyone can quickly find what works! Like a post or want to say, "Thank You" - ?? Click on the Kudos button!
    Trustworthy information: Brian Krebs: 3 Basic Rules for Online Safety and Consumer Reports: Guide to Internet Security Online Safety Tip: Change your passwords often!

  • Want particular behavior from Apple Mouse

    I am new to Premiere having switched from FCP. There's a particular behavior I would like to get from the mouse. I am referring to the Apple mouse with the little trackball on top that's been around for years.
    I want to be able to scrub through a clip and then when I get to a point where I want to start playing the clip click the "secondary button" on the mouse and the clip goes into normal play. Specifically I want that click to cause 'Play-Stop Toggle' to happen.
    I suspect this is simple and I'm just missing something. I am using the default keyboard shortcuts. This is the command assigned to the spacebar.
    Any help is appreciated!
    Thanks!
    Mike Harpe
    Sellersburg, IN

    Steermouse allows keyboard shortcuts to be assigned to mouse buttons. Not all mice are supported:
    http://plentycom.jp/en/steermouse/

  • Particular behavior with my Mac store

    HelloTeam,
    Problem Description:
    Since I have reinstall my MacOS installation, I've some random behavior with my Mac App Store.
    Randomly, Mac App Store asks me to upgrade some applications never installed, not on my system, they appear to be linked with an another account !
    Here some example, this morning Mac App Store asks me to upgrade "Read Later" with an account name xxxxxx(note this software is note install on my Mac)
    An another special behavior, when I try to install a free software such as Twitter, the account used is again linked with an another account not my account
    Actions done:
    To solve this behavior I have try to run as without success:
    CleanMyMac
    Onyx
    Ccleaner
    Upgrade problem
    I've a error message if I try to upgrade this app who indicate that some upgrade are available on other accounts please connect on it.
    Free App (twitter)
    I've try to add my account but I've the following error: Error Unknown
    I hope this information can help you to solve this behavior.
    Best regards
    <Edited By Host>

    Im back with my result,
    I have made a global search on my harddisk (name is HD) with the following search parametters Name contains _MASReceipt and click on find
    FAF give me 4 results:
    - Growl
    - MplayerX
    - The Unarchiver
    - Xcode
    Based on my search all appears to be free.
    I've try to remove my Twitter client (echofon light) and try to reinstall official Twitter app.
    I've exactly the same problem particular email address proposed : xxxxxxx
    Did you have any other idea ?
    Edited post: Many thanks for FAF, it's a very good app
    Message was edited by: LEFBE
    <Edited By Host>

Maybe you are looking for

  • Internal hard drive not showing up in Finder

    Hello. Whenever I use Lightroom and Photoshop, I have been getting the error about my startup disk being low on space. I've read through several threads and instructions on different strategies to take. However, many of them start with being able to

  • Streaming .mov files through shockwave with Quicktime 7

    I'm running a site (www.soundjunction.org) that streams quicktime audio and video files embedded in a shockwave player. This worked fine with QT 6.5.2 but with the upgrades to QT7.0.x, it now sticks on the 'buffering' stage forever and never loads in

  • AS01 with reference to existing asset

    Hello, I am trying to create a new asset with reference to an existing asset.  In this case, the new asset will be in a different asset class from the original asset. The two asset classes have been configured for different depreciation terms.  Howev

  • Copy(string1, string2)

    Hi, In Forms pl/sql you can use this command to copy between two strings, where you can dybnamically build the string names. It doesn't seem to be in database pl/sql, anyone know how to do this in database pl/sql please ?????? TIA Tony

  • Using iDVD in web site

    I have created a gorgeous iDVD with the theme from 6.0. I can't however, put the intro theme section into my web site. I have tried several things but none have worked. It only allows me to transfer the slide show part. The gorgeous part IS the intro