Difference between revisions of "Talk:PChar"

From Free Pascal wiki
Jump to navigationJump to search
(Created page with "I noticed that throughout this page the spelling "pChar" is used.<br> The type PChar is defined in the system unit (rtl/inc/systemh.inc), where the spelling is "PChar".<br> Al...")
 
Line 1: Line 1:
 +
== Spelling ==
 
I noticed that throughout this page the spelling "pChar" is used.<br>
 
I noticed that throughout this page the spelling "pChar" is used.<br>
 
The type PChar is defined in the system unit (rtl/inc/systemh.inc), where the spelling is "PChar".<br>
 
The type PChar is defined in the system unit (rtl/inc/systemh.inc), where the spelling is "PChar".<br>
 
Also: this page is called "PChar".<br>
 
Also: this page is called "PChar".<br>
 
I would propose to change all occurences of "pChar" with "PChar" (and "pAnsiChar" with "PAnsiChar"). --[[User:Bart|Bart]] ([[User talk:Bart|talk]]) 12:24, 29 August 2021 (CEST)
 
I would propose to change all occurences of "pChar" with "PChar" (and "pAnsiChar" with "PAnsiChar"). --[[User:Bart|Bart]] ([[User talk:Bart|talk]]) 12:24, 29 August 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:
 +
<syntaxhighlight lang="pascal">
 +
uses sysutils;
 +
var
 +
  p: pchar;
 +
begin
 +
  p := 'Hello';
 +
  writeln(p);
 +
  p := 'Hello World';
 +
  writeln(p);
 +
end.</syntaxhighlight>
 +
 +
The example in [[User Changes 3.0#Literal storage memory has been made read-only|User Changes 3.0]] however crashes, as promised. --[[User:Bart|Bart]] ([[User talk:Bart|talk]]) 12:37, 29 August 2021 (CEST)

Revision as of 12:37, 29 August 2021

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)


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)