Autor Beitrag
malibu85
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 51



BeitragVerfasst: Do 27.12.07 13:22 
Hallo ich muss für eine Klausur, etwas über Zeiger und Pointer wissen. Leider kan ich die Programmierbeispiel vom Doc nicht nachmachen, da ich folgende Fehlermeldung beim compileren erhalte:
[Pascal Fehler] Unit1.pas(42): E2410 Unsichere Zeigervariablen, Parameter oder Konstanten sind nur in unsicheren Prozeduren zulässig.
Habe mit den Compilerbefehlen {$UNSAFECODE ON} und {$T+} versucht diese Sperre zu umgehen aber hat nicht funktioniert.

Ich geb noch mal den gesamten quelltxt an
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
unit Unit1;
 
interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Borland.Vcl.StdCtrls, System.ComponentModel;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

  Type T_Stoffe = Record

       Aluminium :real;
       Eisen     :real;
       Silber    :real;
       Kupfer    :real;
       Zinn      :real;

  End;

var
  Form1: TForm1;



implementation

{$R *.nfm}
{$T+}
{$UNSAFECODE ON}
procedure TForm1.Button1Click(Sender: TObject);

var Zeiger_T_Stoffe:^T_Stoffe;

begin

new(Zeiger_T_Stoffe);




end;

end.


wie man sieht nichts spannendes. Das steht in jedem Kapitel über Zeiger drin aber leider nichts über den Sicherheitscode und ddessen Einstellungen. Liegt bestimmt an .net?
LorenzS
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 128

MS-DOS, WIN 7, WIN 10
BP7.0, D3, D5
BeitragVerfasst: Do 27.12.07 14:39 
versuche mal
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
Type 
 T_StoffePtr=^T_Stoffe;

procedure TForm1.Button1Click(Sender: TObject); 
var 
 Zeiger_T_Stoffe:T_StoffePtr; 

begin
 new(Zeiger_T_Stoffe);
 //oder
 getmem(Zeiger_T_Stoffe,sizeof(Zeiger_T_Stoffe^));
end;
Escalade
ontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 18

Win 95 Only
Pascal only
BeitragVerfasst: Do 27.12.07 14:43 
Jop liegt nur am .NET