unsafe-pointers

Should I rewrite my DSP routines in C/C++ or I'm good with C# unsafe pointers?

I'm currently writing a C# application that does a lot of digital signal processing, which involves a lot of small fine-tuned memory xfer operations. I wrote these routines using unsafe pointers and they seem to perform much better than I first thought. However, I want the app to be as fast as possible. Would I get any performance benef...

Locked pointer when locking a rectangle in a C# Bitmap

This may be a repeat of the following unanswered question: Help with bitmap lock - Format8bppIndexed I'm locking an image in the following manner: // PixelFormat is 8BppIndexed in my case. Bitmap bmp = new Bitmap("mySampleImage.tif"); // ClipRectangle will be a Rectangle such as {x=128, y=290, width=250, height=200}, // selecte...

dereference and advance pointer in one statement?

I'm reading from a byte array as follows: int* i = (int*)p; id = *i; i++; correct me if I'm wrong, but ++ has precedence over *, so is possible to combine the *i and i++ in the same statement? (e.g. *i++) (this is technically unsafe C#, not C++, p is a byte*) ...

Dynamically setting value on array of pointers to integers

I have a multidimentional array of pointers to integer (of unknown rank) being passed into my function as such: public unsafe static void MyMethod(Array source, ...) { //... } Multidimensional arrays of pointers are being constructed outside of the method and being passed in. Here's an example: int*[,,,] testArra...

How to read string from pointer to buffer in C#

Hi, How can I read the error string in C# from this C++ dll call? // // PARAMETERS: // objptr // Pointer to class instance. // // pBuffer // Pointer to buffer receiving NULL terminated error message string. // If this value is zero, the function returns the required buffer size, in bytes, // and makes no use of the pB...

Run a C# application, complied with "Allow unsafe code" setting, from a network location.

My C# application uses pointers and hence is complied using the "Allow Unsafe Code" setting. I know that it is quite difficult or not possible at all to run such an application from a network location.(or is there any way to run it??) What I would like to know is, is there any way to handle the error that occurs while trying to run this...

system crash after declaring global object of the class

hi, i am very new to c++. i am getting system crash (not compilation error) in doing following: i am declaring global pointer of class. BGiftConfigFile *bgiftConfig; class BGiftConfigFile : public EftBarclaysGiftConfig { } in this class i am reading tags from xml file. it is crashing system when this pointer is used to retrieve va...

Assign a reference of an integer in a class

Is it possible to pass an integer as reference at class initialization and safe the reference? class Foo { private int _refVal; public Foo(ref int val) { _refval = val; // saves the value, not the reference } } I could use pointers, but then I need an unsafe context. ...

Do classes with uninitialized pointers have undefined behavior?

class someClass { public: int* ptr2Int; }; Is this a valid class (yes it compiles)? Provided one assigns a value to ptr2Int before dereferencing it, is the class guaranteed to work as one would expect? ...