casting Questions

3

Solved

I'm receiving a buffer from a network which was converted to an array of 32-bit words. I have one word which is defined as an IEEE-754 float by my interface document. I need to extract this word fr...
Skilful asked 15/2, 2018 at 9:2

3

Solved

I am developing web service that will receive JSON. Go converts types too strict. So I did following function to convert interface{} in bool func toBool(i1 interface{}) bool { if i1 == nil { r...
Nominative asked 18/1, 2014 at 18:28

2

Solved

I have the following code: let show = { createTag: false, updateFeature: false, createFeatureGroup: false, deleteFeature: false, deleteCycle: false, }; And I'm getting a value from the querys...
Black asked 5/10, 2021 at 22:36

5

Solved

I'm trying to put the values of a string into a byte array with out changing the characters. This is because the string is in fact a byte representation of the data. The goal is to move the input...
Inotropic asked 6/6, 2011 at 15:1

29

Solved

In this question, someone suggested in a comment that I should not cast the result of malloc. i.e., I should do this: int *sieve = malloc(sizeof(*sieve) * length); rather than: int *sieve = (int *...
Heifetz asked 3/3, 2009 at 10:13

7

Solved

I have my base class as follows: class point //concrete class { ... //implementation } class subpoint : public point //concrete class { ... //implementation } How do I cast from a point objec...
Cranial asked 7/8, 2012 at 22:27

2

Solved

I'm following these (1, 2) guides to create a sender Android application for Chromecast and I'm only interested in sending pictures. There are a lot of informaton and samples how to cast Text, Aud...
Ebro asked 4/6, 2015 at 12:30

6

What is the difference between boxing/unboxing and type casting? Often, the terms seem to be used interchangeably.
Lapidate asked 6/7, 2009 at 2:17

3

Solved

I'm having one null-able bool (bool?) variable, it holds a value null. One more variable of type pure bool, I tried to convert the null-able bool to bool. But I faced an error "Nullable object must...
Crosier asked 4/1, 2016 at 5:48

2

Solved

How to get an Integer instead of Long from JSON? I want to read JSON in my Java program, but when I get a JSON value which is a number, my parser returns a number of type Long. I want to get an I...
Elysha asked 1/1, 2014 at 13:32

11

Solved

My question is shown in this code I have class like that public class MainCS { public int A; public int B; public int C; public int D; } public class Sub1 { public int A; public int B; pub...
Flub asked 8/9, 2010 at 23:40

5

I am trying to cast to Decimal in MySQL like this: CAST((COUNT(*) * 1.5) AS DECIMAL(2)) I'm trying to convert the number of rows in a table (times 1.5) to a floating point number with two digits...
Cessation asked 6/8, 2012 at 14:41

10

Solved

Why is m always = 0? The x and y members of someClass are integers. float getSlope(someClass a, someClass b) { float m = (a.y - b.y) / (a.x - b.x); cout << " m = " << m << "\...
Durra asked 28/3, 2011 at 9:9

2

I was getting some weird errors that after much searching appeared to (maybe) come from my data not being considered numeric in some cases. This seems to be because I used Float64 dtype (which I th...
Preachy asked 16/9, 2021 at 2:24

2

Solved

Consider: float const& f = 5.9e-44f; int const i = (int&) f; Per expr.cast/4 this should be considered as, in order: a const_­cast, a static_­cast, a static_­cast followed by a const_­ca...
Milzie asked 26/3, 2021 at 12:13

17

Solved

I need to get the value of a field using reflection. It so happens that I am not always sure what the datatype of the field is. For that, and to avoid some code duplication I have created the follo...
Fuliginous asked 14/7, 2011 at 8:57

2

Solved

In C++, I'm trying to print the address of a C-string but there seems to be some problem with my cast. I copied the code from a book but it just doesn't compile on my mac. const char *const word =...
Brancusi asked 12/5, 2015 at 21:18

5

Solved

We are trying to cast an instance of IQueryable<EntityObject> to an IQueryable<SpecificEntityObject>, the SpecificEntityObject type is only known at runtime. We have tried using the co...
Worshipful asked 11/1, 2012 at 12:7

3

Solved

In the following, I have a generic function fun <T : Number> sum(list : List<T>) : T with a type parameter T : Number. In the function, I sum up the list's numbers as a sum : Double and...
Burgle asked 3/12, 2021 at 11:22

6

Solved

I have an id that is represented at an int64. How can I convert this to a []byte? I see that the binary package does this for uints, but I want to make sure I don't break negative numbers.
Dilatory asked 12/2, 2016 at 20:11

3

Solved

How can I cast a Java object into a boolean primitive I tried like below but it doesn't work boolean di = new Boolean(someObject).booleanValue(); The constructor Boolean(Object) is undefined...
Dann asked 5/2, 2010 at 10:47

11

Solved

I am trying to adapt an existing code to a 64 bit machine. The main problem is that in one function, the previous coder uses a void* argument that is converted into suitable type in the function it...
Kinson asked 30/9, 2008 at 13:43

3

Solved

I have a benefit_type integer column in Provider Model Which is a enum column. Provider.rb enum: ['abc', 'bcd'] Now I want to migrate to array_enum Provider.rb array_enum: {'abc': 0, 'bcd':...
Lifton asked 25/2, 2020 at 6:21

2

Solved

Hi i would like to query a table based on its primary key. i have tried both var deviceDetails = (from d in db.Devices where d.DeviceId == pointDetails.DeviceId select d).ToList(); EDIT d.De...
Reckoning asked 3/3, 2014 at 23:22

5

Solved

I have a ComboBox filled with mixed items of two different types. The types are either KeyValuePair<Int32, FontFamily> or KeyValuePair<Int32, String> Now there are occasions where...
Bunting asked 25/9, 2015 at 12:6

© 2022 - 2024 — McMap. All rights reserved.