unsafe Questions

1

Solved

I want to build a class TParent containing several child objects by using aggregation. Some of the objects are independant, while some can be also dependant on the other children. All the children ...
Cob asked 3/11, 2017 at 2:50

2

Solved

I am using some unsafe code in my .NET Core app. For that, I had made this change in the project.json file: "compilationOptions": { "allowUnsafe": true, } However, I still get...
Hollander asked 31/8, 2016 at 18:14

5

Solved

I have a large project about static source code analysis, and everything compiles successfully, except for one thing. I have provided the error message in the title. The point that confuses me is t...
Pastis asked 25/11, 2012 at 12:8

5

Solved

I've not done any pointers since I've been programming in C# - and my C++ days were long ago. I thought I should refresh my knowledge and was just playing around with them because of another questi...
Stepheniestephens asked 13/1, 2010 at 14:51

2

Solved

I've been trying to write a shell in Rust that links directly to the libc library. I've used a Vec<String> to hold the arguments to be passed to execvp(), but it seems that my conversion to c...
V2 asked 10/3, 2017 at 11:37

1

Solved

What is the implementation for this function: fn unbox<T>(value: Box<T>) -> T { // ??? } The only function in the documentation that looks like what I want is Box::into_raw. The ...
Forwhy asked 16/2, 2017 at 3:2

1

I'm trying to write a little buffer-thing for parsing so I can pull records off the front of as I parse them out, ideally without making any copies and just transferring ownership of chunks of the ...
Granese asked 10/2, 2017 at 16:18

5

Solved

I came across some interesting code in java.lang.Class#newInstance0: // Run constructor try { return tmpConstructor.newInstance((Object[])null); } catch (InvocationTargetException e) { Unsafe.ge...
Acquaint asked 7/12, 2010 at 10:51

2

Solved

As I understand it, a [[T; 4]; 3] and a [T; 12] have the same layout in memory. What is the best way to convert a value between these types? Can I convert a reference to one into a reference to the...
Matadi asked 13/12, 2016 at 1:30

1

I use window.URL.createObjectURL to create a blob:http link for previewing selected image in an img tag: <img src=""{{itemPhoto}}"" /> itemPhoto is a field defined in a component and gets ...
Archon asked 27/9, 2016 at 21:14

1

What's a good way to fill in a vector of structs in Rust where: The size is dynamic, but known at the time of initialization. Doesn't first initialize the memory to a dummy value. Doesn't re-allo...
Jokjakarta asked 10/8, 2016 at 2:27

2

Did anyone try to move java objects off heap? I tried using serializing, deserializing and storing byte arrays by using Unsafe libraries. But complex objects with multiple objects in it making this...
Urea asked 12/8, 2014 at 6:17

1

Solved

Experiment I tried the following snippet on Spark 1.6.1. val soDF = sqlContext.read.parquet("/batchPoC/saleOrder") # This has 45 files soDF.registerTempTable("so") sqlContext.sql("select dpHour, ...
Vauban asked 10/6, 2016 at 19:37

3

I need to pass an argument to an unsafe DllImported function in the form of: [DllImport("third_party.dll")] private static extern unsafe int start(int argc, char** argv); I'm assuming it's...
Banter asked 9/6, 2016 at 18:11

4

I am doing a project in C#, which could benefit from a linear algebra package. I've looked at the ones out there, but I don't really want to pay, or I found them not very good. So I decided to writ...
Dandle asked 15/5, 2016 at 16:16

2

Solved

I have code that creates a RefCell and then wants to pass a reference to that RefCell to a single thread: use crossbeam; // 0.7.3 use std::cell::RefCell; fn main() { let val = RefCell::new(1); ...
Alunite asked 15/4, 2016 at 14:27

1

Solved

I need to marshal some nested structures in C# 4.0 into binary blobs to pass to a C++ framework. I have so far had a lot of success using unsafe/fixed to handle fixed length arrays of primitive ty...
Nial asked 17/3, 2016 at 22:57

1

Solved

I'm working with raw pointers in Rust and am trying to copy an area of memory from one place to another. I've got it successfully copying memory over, but only using a for loop and copying each byt...
Gordie asked 11/3, 2016 at 11:2

2

Solved

I never needed to use unsafe in the past, but now I need it to work with a pointer manipulating a bitmap. I couldn't find any documentation that indicates otherwise, but I would like to understand...
Emma asked 22/1, 2016 at 14:6

1

Does Java unsafe API support memcpy from JVM primitive array into direct memory? Note, existing call unsafe.copyMemory() copies from src to dst in the direct memory. I am interested in both writing...
Pugnacious asked 10/1, 2016 at 3:51

1

Sorry for the confusing title, but I can't think of a better way to explain it. While browsing the source code of BitConverter recently, I came across a strange segment of code: public static uns...
Pandybat asked 26/8, 2015 at 1:7

3

I have been searching through the C# language spec and I can't find anything which says whether a pointer type (e.g. int*) gets initialized with a default value. I created a simple test app and it ...
Quotation asked 6/2, 2015 at 13:21

1

The preferred way of converting []byte to string is this: var b []byte // fill b s := string(b) In this code byte slice is copied, which can be a problem in situations where performance is impor...
Folkestone asked 27/11, 2015 at 7:35

4

Solved

I read here that Spring and many other popular libraries will break if Oracle removes sun.misc.Unsafe in Java 9. However, there are no static references to this class in Spring or Hibernate. So, is...
Gorden asked 14/7, 2015 at 21:3

3

I'm trying to publish a web application (with VS2012 Web) in which I need to run a vb script. That script currently doesn't run correctly probably because of the lack of permissions. I am currentl...
Vallie asked 15/5, 2013 at 14:2

© 2022 - 2024 — McMap. All rights reserved.