Forum > General

Translating from C

<< < (2/3) > >>

geraldholdsworth:
I actually use both Zipper and ZStream in other parts of the project for compressing and decompressing ZIP data and GZip data, respectively.

For the size of the LZW decompression code, it will hardly make much of a difference.

del:
Good luck with pointers in Pascal. The documentation is pretty silly. The "tutorials" typically have a pointer, and a fixed array, and then they'll have the pointer point to the fixed array.   >:(

And there's a weird wrinkle with Move(srcPtr, dstPtr, numBytes). You have to "deference" the pointers to make this work: Move(srcPtr^, dstPtr^,  numBytes). I do a lot of chained floating point image processing and the available image containers don't support floating point. So I have to roll my own. At any rate, if you're fluent in C you might want to try a pure pointer (no dynamic arrays) solution in Pascal.

440bx:

--- Quote from: del on June 08, 2021, 02:06:53 pm ---Good luck with pointers in Pascal. The documentation is pretty silly.

--- End quote ---
As much as I dislike C, I have to concede that pointer handling makes a lot more sense in C than in Pascal, particularly when someone had the "bright idea" of creating untyped variables which is what causes the nonsense of having to dereference a pointer to get the pointer to the memory block.  (whoever thought of that one probably smoked red paint for breakfast.)

All that said, if a programmer is disciplined enough to stay away from those "creative" gimmicks, pointer handling in Pascal is, at least quite close to, as flexible and powerful as it is in C.

del:

--- Quote from: 440bx on June 08, 2021, 02:26:13 pm ---
--- Quote from: del on June 08, 2021, 02:06:53 pm ---Good luck with pointers in Pascal. The documentation is pretty silly.

--- End quote ---
As much as I dislike C, I have to concede that pointer handling makes a lot more sense in C than in Pascal, particularly when someone had the "bright idea" of creating untyped variables which is what causes the nonsense of having to dereference a pointer to get the pointer to the memory block.  (whoever thought of that one probably smoked red paint for breakfast.)

All that said, if a programmer is disciplined enough to stay away from those "creative" gimmicks, pointer handling in Pascal is, at least quite close to, as flexible and powerful as it is in C.

--- End quote ---

I'm loving it so far. Other than that little rant I posted. The cool thing is that Heap Trace still works when you do your own pointer stuff.

marcov:
I'm already doing image analysis in Pascal for near on 18 years now, 15 years of that full time.

In the early days I had C dlls, but in the end I converted it all to Delphi/FPC long ago. The speed was not measurably different. Usually memory performance is dominant.

I now have C++ DLLs again, but that is not std C++ code, but a powerful combination of templates and intrinsics, mostly from https://ermig1979.github.io/Simd/

The trick they use there for kernel operations is that they use the template code for the bounderies of a kernel operation (but hardwire some parameters to 0) as for the bulk.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version