AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

C++ pointer to byte array --> Delphi

Ein Thema von WojTec · begonnen am 1. Dez 2013 · letzter Beitrag vom 2. Dez 2013
Antwort Antwort
WojTec

Registriert seit: 17. Mai 2007
482 Beiträge
 
Delphi XE6 Professional
 
#1

Re: C++ pointer to byte array --> Delphi

  Alt 2. Dez 2013, 12:09
If I remember in C and similar || and && is Boolean arithmetic, but | and & is for bits. In Delphi and/or is applicateble for both (compiler decide real meaning), so "|" really mean "or" or need some additional tricks?
@DeddyH, you was first , thanks

So, my code is ok?
  Mit Zitat antworten Zitat
Benutzerbild von DeddyH
DeddyH

Registriert seit: 17. Sep 2006
Ort: Barchfeld
27.659 Beiträge
 
Delphi 12 Athens
 
#2

AW: C++ pointer to byte array --> Delphi

  Alt 2. Dez 2013, 12:12
Please have a look at the edit in my last post.
Detlef
"Ich habe Angst vor dem Tag, an dem die Technologie unsere menschlichen Interaktionen übertrumpft. Die Welt wird eine Generation von Idioten bekommen." (Albert Einstein)
Dieser Tag ist längst gekommen
  Mit Zitat antworten Zitat
WojTec

Registriert seit: 17. Mai 2007
482 Beiträge
 
Delphi XE6 Professional
 
#3

Re: C++ pointer to byte array --> Delphi

  Alt 2. Dez 2013, 12:19
It mean if case 11 then process all, if 10 than all instead above, etc.?

And what about rest operations? Indexes are valid? 256 multiply is required?
  Mit Zitat antworten Zitat
Benutzerbild von DeddyH
DeddyH

Registriert seit: 17. Sep 2006
Ort: Barchfeld
27.659 Beiträge
 
Delphi 12 Athens
 
#4

AW: C++ pointer to byte array --> Delphi

  Alt 2. Dez 2013, 12:29
I am not that familiar with C/C++, sry.
Detlef
"Ich habe Angst vor dem Tag, an dem die Technologie unsere menschlichen Interaktionen übertrumpft. Die Welt wird eine Generation von Idioten bekommen." (Albert Einstein)
Dieser Tag ist längst gekommen
  Mit Zitat antworten Zitat
Namenloser

Registriert seit: 7. Jun 2006
Ort: Karlsruhe
3.724 Beiträge
 
FreePascal / Lazarus
 
#5

AW: C++ pointer to byte array --> Delphi

  Alt 2. Dez 2013, 12:53
Looks mostly good to me, but I would pay some extra attention to the type casts. I am not sure if ord() always gives the correct result here. In some places the type cast might be done to truncate a value. For example, (ushort)foo gives us the lowest 16 bits of foo .

And in the top code, I think you can get rid of ord() entirely, if you've correctly translated char as byte.

Geändert von Namenloser ( 2. Dez 2013 um 12:55 Uhr)
  Mit Zitat antworten Zitat
WojTec

Registriert seit: 17. Mai 2007
482 Beiträge
 
Delphi XE6 Professional
 
#6

Re: C++ pointer to byte array --> Delphi

  Alt 2. Dez 2013, 13:58
I completely don't understand what for is type casts from byte Variables whare are moved results can store entire data without truncating or something alse. What do you think?

Ord() is used, because AValue is string, I plan change it to TBytes.
  Mit Zitat antworten Zitat
Namenloser

Registriert seit: 7. Jun 2006
Ort: Karlsruhe
3.724 Beiträge
 
FreePascal / Lazarus
 
#7

AW: Re: C++ pointer to byte array --> Delphi

  Alt 2. Dez 2013, 15:17
Variables whare are moved results can store entire data without truncating or something alse. What do you think?
I am not sure what you mean by that sentence, "whare" was not a word last time I checked .

I assume you wanted to say that the typecasts are unnecessary, which may be true. I didn't examine the code that closely, I was just saying that you should pay attention to that.
  Mit Zitat antworten Zitat
Mikkey

Registriert seit: 5. Aug 2013
265 Beiträge
 
#8

AW: Re: C++ pointer to byte array --> Delphi

  Alt 2. Dez 2013, 12:51
It mean if case 11 then process all, if 10 than all instead above, etc.?

And what about rest operations? Indexes are valid? 256 multiply is required?
Don't worry with 256: Multiplying with 256 is the same as shifting left 8 bits.

You must invent some construct for the C-Case, bcse the Delphi case has implicit C-"break"s. Perhaps like:

Delphi-Quellcode:
if length = 11 then ...
if length >= 10 then ...
if length >= 9 then ...
...
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 11:06 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz