signed Questions

5

I have just started learning C and a question has bugged me for a while now. If I write int i = -1; unsigned int j = 2; unsigned int k = -2; What is the type of integer literal -1 and 2 and -2, ...
Damnatory asked 31/12, 2016 at 4:53

5

Go's builtin len() function returns a signed int. Why wasn't a uint used instead? Is it ever possible for len() to return something negative? As far as I can tell, the answer is no: Arrays: "The...
Ell asked 22/8, 2016 at 21:22

6

In C, why is signed int faster than unsigned int? True, I know that this has been asked and answered multiple times on this website (links below). However, most people said that there is no differe...
Menopause asked 8/12, 2015 at 20:9

5

Solved

Consider the following code: #include <iostream> #include <type_traits> int main() { std::cout << "std::is_same<int, int>::value = " << std::is_same<i...
Scarify asked 12/5, 2013 at 1:38

7

Solved

Let's say I have this number i = -6884376. How do I refer to it as to an unsigned variable? Something like (unsigned long)i in C.
Gerdagerdeen asked 24/12, 2013 at 21:14

1

Solved

I have a situation where I need to pack 16 bits into a 64-bit number and later read them back as a signed integer in the range [ -32768, 32768 ). The method I have chosen for this is to compute the...
Mcneese asked 1/9, 2023 at 17:59

2

Solved

I was wondering how do you convert from an 8 bit 2's complement to a 16 bit 2's complement signed number? 1100 0110 is an example
Tamah asked 21/10, 2012 at 3:56

7

Solved

I am reading the book: CS-APPe2. C has unsigned and signed int type and in most architectures uses two's-complement arithmetic to implement signed value; but after learning some assembly code, I fo...
Rubenstein asked 19/10, 2013 at 8:47

10

Solved

I still haven't found a reason why the lowest signed negative number doesn't have an equivalent signed positive number? I mean in a 3 digit binary number for simplicity 100 is -4? but we can't have...
Jessalin asked 18/1, 2012 at 20:53

3

Solved

Two's complements is set to make it easier for computer to compute the substraction of two numbers. But how computer distinguish an integer is signed integer or unsigned integer? It's just 0 and 1 ...
Daredeviltry asked 5/6, 2012 at 7:23

7

Solved

I was curious to know what would happen if I assign a negative value to an unsigned variable. The code will look somewhat like this. unsigned int nVal = 0; nVal = -5; It didn't give me any comp...
Susie asked 26/4, 2010 at 6:42

9

If lv stores a long value, and the machine is 32 bits, the following code: iv = int(lv & 0xffffffff) results an iv of type long, instead of the machine's int. How can I get the (signed) i...
Specular asked 3/9, 2009 at 20:54

3

I'm creating app in Kotlin and I paid Google developer account. But there is some problem with upload .aab file: The Android App Bundle was not signed. I readed all topics at Stackoverflow about it...
Lachrymal asked 17/9, 2021 at 10:28

5

Solved

I know about int and long (32-bit and 64-bit numbers), but what are uint and ulong?
Kovar asked 16/9, 2010 at 6:36

5

I'd like to calculate x/y where x and y are both signed integers, and get a result rounded to the nearest integer. Specifically, I'd like a function rquotient(x, y) using integer-only arithmetic su...
Chant asked 31/1, 2020 at 18:57

6

I'm trying to understand why the following code doesn't issue a warning at the indicated place. //from limits.h #define UINT_MAX 0xffffffff /* maximum unsigned int value */ #define INT_MAX 2147483...
Olen asked 24/3, 2011 at 8:17

0

I wanted a signed type corresponding to std::size (ideally computed from it rather than relying on another definition that could be independent.) Naturally I thought to use std::make_signed_t<st...
Skald asked 11/4, 2022 at 18:33

17

Am I correct to say the difference between a signed and unsigned integer is: Unsigned can hold a larger positive value and no negative value. Unsigned uses the leading bit as a part of the value, ...
Ipecac asked 29/10, 2008 at 18:28

7

Solved

public class Main3 { public static void main(String[] args) { Integer min = Integer.MIN_VALUE; String minHex = Integer.toHexString(Integer.MIN_VALUE); System.out.println(min + " " + minHex); ...
Feliks asked 10/5, 2009 at 12:17

1

I came to know through this answer that: Signed overflow due to computation is still undefined behavior in C++20 while Signed overflow due to conversion is well defined in C++20(which was implemen...
Retirement asked 21/1, 2022 at 12:41

2

Solved

I am trying to understand the meaning of the statement: (int)(unsigned)-1 == -1; To my current understanding the following things happen: -1 is a signed int and is casted to unsigned int. The res...
Arturoartus asked 21/1, 2022 at 6:0

6

Solved

This feels like it should be very simple, but I haven't been able to find an answer.. In a python script I am reading in data from a USB device (x and y movements of a USB mouse). it arrives in si...
Splenitis asked 12/6, 2013 at 14:14

2

Solved

What are the main deference between Build bundle vs Generate Signed bundle android studio.
Anse asked 30/1, 2020 at 6:5

13

Solved

At first glance, this question may seem like a duplicate of How to detect integer overflow?, however it is actually significantly different. I've found that while detecting an unsigned integer ove...
Turgent asked 15/10, 2010 at 17:16

9

I work with a lot of calculation code written in c++ with high-performance and low memory overhead in mind. It uses STL containers (mostly std::vector) a lot, and iterates over that containers almo...
Washington asked 19/4, 2011 at 9:5

© 2022 - 2025 — McMap. All rights reserved.