Thread: Two's Complement Exception or Flaw.

  1. #1
    Banned
    Join Date
    Jul 2022
    Posts
    112

    Two's Complement Exception or Flaw.

    Can this be considered a design flaw,
    or a regular exception ??

    Code:
    int a = -2147483648;
    int b = ~a;
    
    b = 1 + b;
    printf("%d\n", a); /* Prints -2147483648.      */
    printf("%d\n", b); /* Also prints -2147483648. */

  2. #2
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    1,115

  3. #3
    Banned
    Join Date
    Jul 2022
    Posts
    112
    If you do not understand a particular context,
    just don't add your half-formed opinion..

  4. #4
    Banned
    Join Date
    Jul 2022
    Posts
    112
    How do you know what I did not study,
    did you examine my lab papers back then ??

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,662
    Well that didn't take long.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Probable flaw
    By Caseon in forum C++ Programming
    Replies: 1
    Last Post: 03-18-2015, 06:38 AM
  2. how it works..!! is it a flaw in c ??
    By veera in forum C Programming
    Replies: 7
    Last Post: 08-12-2013, 08:41 PM
  3. Design flaw in C++?
    By @nthony in forum C++ Programming
    Replies: 24
    Last Post: 10-20-2008, 07:47 PM
  4. design flaw
    By Bleech in forum Windows Programming
    Replies: 2
    Last Post: 10-23-2007, 11:10 PM
  5. is this a design flaw
    By blight2c in forum C++ Programming
    Replies: 5
    Last Post: 03-20-2002, 12:33 AM

Tags for this Thread