struct Questions

5

I'm hoping this isn't a duplicate question, but I've searched in some detail and haven't found my exact case before. I have a simple struct that I also want to be able to access as a simple byte a...
Inhabitancy asked 7/5, 2014 at 18:46

3

Solved

I have data with below schema. I want all the columns should be in sorted alphabetically. I want it in pyspark data frame. root |-- _id: string (nullable = true) |-- first_name: string (nullable...
Swatow asked 6/9, 2019 at 11:54

1

Solved

I am encountering a puzzling error when creating a tuple-like struct somewhere in my Rust project. The error I boiled my issue down to the following snippet: mod parent { pub struct X(u32); mod ...
Oe asked 17/9 at 11:20

3

Solved

I have a Dataframe with different columns where one of the columns is an array of structs: +----------+---------+--------------------------------------+ |id |title | values| +----------+---------+-...
Bigamist asked 17/6, 2018 at 22:43

2

Solved

We need to use a custom unmarshaler for a struct nested in multiple other structs which don't require a custom unmarshaler. We have lots of structs similar to B struct defined below (similar as in ...
Disney asked 12/9, 2018 at 11:24

5

Solved

Essentially, I am trying to run a query on a MySQL database, get the data made converted into JSON and sent back to the client. I have tried several methods and all of the "easy" ones result in sen...
Piotrowski asked 13/3, 2017 at 22:19

5

Solved

I want the size of a C struct to be multiple of 16 bytes (16B/32B/48B/..). It does not matter which size it gets to; it only needs to be multiple of 16 bytes. How could I enforce the compiler to d...
Attainable asked 21/6, 2012 at 0:40

5

So I'm going through the Apple docs here - Apple Docs Then I ran into this: public struct TrackedString { public private(set) var numberOfEdits = 0 public var value: String = "" { didS...
Bannerol asked 16/5, 2016 at 23:35

5

I have multiple structs in my application using golang. Some fields in a struct have maxsize tags, some does not have. for e.g: type structone struct { fieldone string `valid:MaxSize(2)` fieldtw...
Novosibirsk asked 22/11, 2019 at 7:30

6

Solved

Continuing my experiments in C, I wanted to see how bit fields are placed in memory. I'm working on Intel 64 bit machine. Here is my piece of code: #include <stdio.h> #include <stdlib.h&gt...
Ikon asked 22/5, 2013 at 13:10

8

Solved

I'm seeing some odd behaviour after using FirstOrDefault() on a collection of structs. I've isolated it into this reproduction case. This program won't compile using System; using System.Linq; na...
Sucrase asked 15/11, 2013 at 15:43

8

Solved

In C#, an anonymous type can be as follows: method doStuff(){ var myVar = new { a = false, b = true } if (myVar.a) { // Do stuff } } However, the following will not compile: method ...
Tremor asked 28/1, 2012 at 8:7

3

Solved

I know you can use public fields, or some other workarounds. Or maybe you don't need them at all. But just out of curiosity, why did Sun leave structures out?
Leslielesly asked 24/11, 2014 at 16:2

8

Solved

Consider this example. Let's say I have this object which is ubiquitous throughout my codebase: type Person struct { Name string Age int [some other fields] } Somewhere deep in the codebase, ...
Pertain asked 5/2, 2019 at 18:15

9

Solved

I have looked around but have been unable to find a solution to what must be a well asked question. Here is the code I have: #include <stdlib.h> struct my_struct { int n; char s[] }; in...
Seymour asked 13/1, 2010 at 23:2

3

Solved

Having this schema: root |-- Elems: array (nullable = true) | |-- element: struct (containsNull = true) | | |-- Elem: integer (nullable = true) | | |-- Desc: string (nullable = true) How can w...
Holdall asked 14/1, 2019 at 19:57

7

I get a transmission over the network that's an array of chars/bytes. It contains a header and some data. I'd like to map the header onto a struct. Here's an example: #pragma pack(1) struct Heade...
Muth asked 6/2, 2009 at 11:15

8

Solved

I was of the impression that in C#, struct elements are allocated on the stack and thus disappear when returning from a method in which they were created. But what happens if I place the struct-val...
Payment asked 31/1, 2011 at 16:19

8

Solved

If I have a struct like struct account { int account_number; }; Then what's the difference between doing myAccount.account_number; and myAccount->account_number; or isn't there a diff...
Georgenegeorges asked 13/5, 2011 at 23:5

4

Solved

I've researched a bit and it seems that the common wisdom says that structs should be under 16 bytes because otherwise they incur a performance penalty for copying. With C#7 and ref return it becam...
Schottische asked 19/9, 2017 at 4:28

3

Solved

I am attempting to read in a binary file. The problem is that the creator of the file took no time to properly align data structures to their natural boundaries and everything is packed tight. This...
Victualer asked 13/1, 2014 at 13:23

17

Solved

On the question 'why do we need to use bit-fields?', searching on Google I found that bit fields are used for flags. Now I am curious, Is it the only way bit-fields are used practically? Do we nee...
Humfrid asked 24/7, 2014 at 12:6

10

Solved

I have a list of say 100k floats and I want to convert it into a bytes buffer. buf = bytes() for val in floatList: buf += struct.pack('f', val) return buf This is quite slow. How can I make it ...
Pyorrhea asked 30/3, 2012 at 10:3

2

Solved

I am trying to anonymize/hash a nested column, but haven't been successful. The schema looks something like this: -- abc: struct (nullable = true) | |-- xyz: struct (nullable = true) | | |-- abc123...
Salisbarry asked 7/1, 2022 at 15:15

2

Solved

I am trying to define a union struct with some struct and primitive members overlapping in memory with a simple array. This works perfectly in Clang and MSVC, but it doesn't compile with GCC (G++)....
Namnama asked 6/5, 2022 at 6:50

© 2022 - 2024 — McMap. All rights reserved.