Now that I have been using FreePascal for a bit, I am now starting to jot down lots of useful notes, and believe these notes could be very useful to someone who is starting out with FreePascal. When I first started learning FreePascal, documentation was at times difficult to find for some very specific units, and I had to read the source files of those units to better understand what was going on and how to use those units. While the Wiki is great, it can be at times difficult to locate exactly what you are looking for, and at times there are multiple pages about a similar topic, but with different solutions. While I am very thankful that there is more than one way to do something in FreePascal, it does lead to some confusion when picking the right solution.Just for the sake of correctness: It's Free Pascal, not FreePascal. ;) (same for ObjectPascal by the way)
@kveroneauThanks, I also guess fpjson doesn't check for this, as it was able to download and parse it with no problem. But, I will update it right away to use double-quotes.
Just as a heads up, your json is not valid. " 'cause " <-- valid. JSON should use double quotes.
Is that a bug or a missing feature?@kveroneauThanks, I also guess fpjson doesn't check for this, as it was able to download and parse it with no problem. But, I will update it right away to use double-quotes.
Just as a heads up, your json is not valid. " 'cause " <-- valid. JSON should use double quotes.
A side note, a new document is now available, it's on Pointers. While pointers are less necessary in Pascal, when compared to C, it's still nice to know of them in-case you do need to use them. And they are needed if you want to add extra meta data to say a TTreeItem, as it's .Data property is a pointer.Congratulations on your effort.
http://tech406.com/kdocs/pointers.xml
This is probably one of my longest example codes so far, but it is something I wish to be-able to reference myself in the future.
I will be adding more, as there is so much more I can write about Pointers. :D
Also, if you're using Integer remember that it may be 4 or 8 bytes, depending on whether the platform is 32 or 64 bits.The size of Integer does not depend on the bitness. It only depends on the mode, namely it's 16 bit in modes fpc, tp and iso and 32-bit in the others.
Good job!+1
... or maybe to export its content to the freepascal wiki, which will be a useful update for.
I am not entirely sure why, but the structure in Python has a size of 85, but the same structure in Object Pascal has a size of 88.is due to data alignment. To align the memory there are three hidden bytes added (padding) after the status byte: 4+1+3+80=88. If you want to avoid that, you need to use packed record and then the record will have a size of 4+1+80=85 as in Python.
The string[80] is a shortstring, a so called "Pascal string".Indeed, wasn't aware of that. :-[
It carries in the byte zero the length, so the string[80] occupies in the packed mode 81 byte.