Talk:PChar

From Free Pascal wiki
Jump to navigationJump to search

Spelling

I noticed that throughout this page the spelling "pChar" is used.
The type PChar is defined in the system unit (rtl/inc/systemh.inc), where the spelling is "PChar".
Also: this page is called "PChar".
I would propose to change all occurences of "pChar" with "PChar" (and "pAnsiChar" with "PAnsiChar"). --Bart (talk) 12:24, 29 August 2021 (CEST)

@Bart: Yeah, it’s a personal preference of me to use camelCase in identifiers, rather than CamelCase. Lowercase being the default, the capitalization of the first letter doesn’t improve readability. ‑‑Kai Burghardt (talk) 14:25, 3 September 2021 (CEST)
Personal preferences differ. CamelCase IMO is more widely accepted than camelCase. Still I'ld prefer to follow the officila fpc source or docs for this. --Bart (talk) 19:38, 3 September 2021 (CEST)

Direct assignments

The sample code is not very clear about what would make it crash. To me the phrasing suggsets that something like this should crash:

uses sysutils;
var
  p: pchar;
begin
  p := 'Hello';
  writeln(p);
  p := 'Hello World';
  writeln(p);
end.

The example in User Changes 3.0 however crashes, as promised. --Bart (talk) 12:37, 29 August 2021 (CEST)

@Bart: I dislike to show faulty code in a full-blown syntaxhighlight box, so I’ve added merely another sentence. Is that OK? ‑‑Kai Burghardt (talk) 14:25, 3 September 2021 (CEST)
Yes, that's fine.--Bart (talk) 19:36, 3 September 2021 (CEST)