Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yes, but none of that would need to change. I hate to keep harping on Object Pascal, but it really is a nice implementation: in OP, you can pass a string to a C API, such as the Windows APIs, like this:

   Result:=CreateFile(pChar(FileName),
                      AccessMode,ShareMode,nil,
                      OpenFlags,AttrFlags,0);
where FileName is a String and pChar is the more traditional C-style pointer to an array of characters. The compiler will prevent you from passing a Unicode/Wide string to an API call that expects an ANSI string pointer, or vice-versa. So, interop with the system-level APIs of Windows or Linux is seamless and easy.


BTW, I almost forgot to mention: the String type in Object Pascal implicitly contains a NULL terminator, so the above call is zero-copy.

More information:

http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Internal_D...

under "Long String Types".




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: