Autor Beitrag
Boldar
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1555
Erhaltene Danke: 70

Win7 Enterprise 64bit, Win XP SP2
Turbo Delphi
BeitragVerfasst: Sa 13.12.08 16:58 
Hallo,
Ich habe diese Deklaration:
ausblenden Delphi-Quelltext
1:
const bytearr : array [1..8of byte = [$00000001$00000010$00000100$00001000$00010000$00100000$01000000$10000000];					


Aber da meckert der Compiler:"[Pascal Fehler] xxxxx.pas(39): E1012 Konstantenausdruck verletzt untere Grenzen"
Früher ging sowas immer...
Was mache ich falsch?
Gruß Boldar
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Sa 13.12.08 17:03 
ausblenden Delphi-Quelltext
1:
const bytearr : array [1..8of byte = ($00000001$00000010$00000100$00001000$00010000$00100000$01000000$10000000);					
;)

ausserdem ist $10000000 = 268435456 und nicht etwa 128. Nimm die zahlen in dezimaldarstellung: 10000000 = 128, 01000000=64 etc.

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.


Zuletzt bearbeitet von JayEff am Sa 13.12.08 17:17, insgesamt 2-mal bearbeitet
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19314
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 13.12.08 17:03 
Du gibst hexadezimale Zahlen an, die weit über die Grenzen von 0..255 für Byte hinausgehen...
der organist
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 467
Erhaltene Danke: 17

WIN 7
NQC, Basic, Delphi 2010
BeitragVerfasst: Sa 13.12.08 17:52 
da kommt bei mir die Frage auf: Welche Zahlen kann man alles verwenden?
-Dezimal (kein Präfix)
-Hexadezimal ($)
-Binär (%[?])
-...?

_________________
»Gedanken sind mächtiger als Waffen. Wir erlauben es unseren Bürgern nicht, Waffen zu führen - warum sollten wir es ihnen erlauben, selbständig zu denken?« Josef Stalin
DeddyH
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 13.12.08 17:54 
Es gibt weder binäre, dezimale noch hexadezimale Zahlen, es gibt nur eine unterschiedliche Darstellung von Zahlen. Ob man nun 255, $FF oder 11111111 schreibt, die dahinterliegende Zahl bleibt gleich.
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Sa 13.12.08 18:01 
user profile iconDeddyH hat folgendes geschrieben Zum zitierten Posting springen:
Es gibt weder binäre, dezimale noch hexadezimale Zahlen, es gibt nur eine unterschiedliche Darstellung von Zahlen.

Ich glaube das ist dem organist in diesem fall klar ;)
user profile iconDeddyH hat folgendes geschrieben Zum zitierten Posting springen:

Ob man nun 255, $FF oder 11111111 schreibt, die dahinterliegende Zahl bleibt gleich.

255=$FF<>11111111 und das ist genau der Punkt in seiner Frage. Gibt es ein Präfix für binär oder andere Zahlendarstellungen.

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
DeddyH
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 13.12.08 18:02 
Achso, dann hab ich das falsch verstanden, sry.
der organist
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 467
Erhaltene Danke: 17

WIN 7
NQC, Basic, Delphi 2010
BeitragVerfasst: Sa 13.12.08 19:07 
Np, Aber nu...was ist das Präfix für binäre zahlen? Oder hab ich es nich gesehen?

MfG,

_________________
»Gedanken sind mächtiger als Waffen. Wir erlauben es unseren Bürgern nicht, Waffen zu führen - warum sollten wir es ihnen erlauben, selbständig zu denken?« Josef Stalin
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19314
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 13.12.08 19:13 
Also ich kenne keins bei Delphi. Keine Ahnung, ob es das gibt. :nixweiss:

(Es hat mich auch wenig interessiert, weil man das ja durch Zusammenfassung leicht im Kopf in Hexadezimaldarstellung umrechnen kann.)
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Sa 13.12.08 20:48 
Es gibt auch keinen Prefix für binär in Delphi. Und selbst in C ist das nicht standardisiert (je nach Compiler unterschiedlich).

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
der organist
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 467
Erhaltene Danke: 17

WIN 7
NQC, Basic, Delphi 2010
BeitragVerfasst: Sa 13.12.08 21:27 
und wie übergebe ich dann eine Binärzahl? Das kann der Compiler doch nicht unterscheiden.

_________________
»Gedanken sind mächtiger als Waffen. Wir erlauben es unseren Bürgern nicht, Waffen zu führen - warum sollten wir es ihnen erlauben, selbständig zu denken?« Josef Stalin
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19314
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 13.12.08 21:39 
Du schreibst die Zahl nicht in Binärschreibweise sondern in Dezimal- oder Hexadezimalschreibweise, wo ist das Problem?

Gerade die Hexadezimalschreibweise ist in diesem Fall natürlich sehr gut geeignet, weil sie einerseits sehr kompakt und andererseits sehr sehr einfach aus der Binärschreibweise berechenbar ist.
JayEff
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2971

Windows Vista Ultimate
D7 Enterprise
BeitragVerfasst: Sa 13.12.08 22:27 
user profile iconjaenicke hat folgendes geschrieben Zum zitierten Posting springen:
sie [...] sehr sehr einfach aus der Binärschreibweise berechenbar ist.
Und für die, die den Trick nicht kennen:

ausblenden Quelltext
1:
2:
3:
Man Teile die Binärzahl in 4er Blöcke: 0011 1010 0101
Jeder davon ergibt eine hex-ziffer:      3  10=A   5
Und man hat von bin in hex gerechnet: 1110100101 = $3A5

Umgekehrt natürlich genauso.

_________________
>+++[>+++[>++++++++<-]<-]<++++[>++++[>>>+++++++<<<-]<-]<<++
[>++[>++[>>++++<<-]<-]<-]>>>>>++++++++++++++++++.+++++++.>++.-.<<.>>--.<+++++..<+.
XUDO
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 45

Win-98SE, Win-XP/1
Delphi-7P, Turbo-Pascal-6
BeitragVerfasst: Fr 26.12.08 12:48 
user profile iconBoldar hat folgendes geschrieben Zum zitierten Posting springen:

Was mache ich falsch?


Hallo Boldar,
in der Anlage ein Progrämmchen, das Dir alles nebeneinander zeigt,
von 0 bis 255 und dazu der Quelltext.
Er enthält Dein vorgesehenes Array und zusätzlich die Werte 9 bis 255.
Viel Erfolg
XUDO
Einloggen, um Attachments anzusehen!
XUDO
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 45

Win-98SE, Win-XP/1
Delphi-7P, Turbo-Pascal-6
BeitragVerfasst: Fr 26.12.08 15:22 
Hallo Bolder,
Noch etwas zum Verständnis der Functions in den Anlagen.
XUDO
Einloggen, um Attachments anzusehen!
Boldar Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 1555
Erhaltene Danke: 70

Win7 Enterprise 64bit, Win XP SP2
Turbo Delphi
BeitragVerfasst: Sa 27.12.08 12:19 
Joa danke dir..