I wonder if anyone here knew Pascal before C++, perhaps you could help me
out. I'm converting some pascal code into C++, and I can't seem to
understand what AType(Ptr)[index] is trying to accomplish. Any helps would
be appreciated. Thanks.
type
AType = array[0..$FF] of byte;
var Ptr : Pointer;
Move(AType(Ptr)[index], dest_word, 2); 11 2174
SGi wrote: I wonder if anyone here knew Pascal before C++, perhaps you could help me out. I'm converting some pascal code into C++, and I can't seem to understand what AType(Ptr)[index] is trying to accomplish. Any helps would be appreciated. Thanks.
type AType = array[0..$FF] of byte;
var Ptr : Pointer;
Move(AType(Ptr)[index], dest_word, 2);
This is a Pascal (or perhaps Delphi) question and should be asked in a
more appropriate forum. See this FAQ for what is on-topic here and for
some possible forums you can post in: http://www.parashift.com/c++-faq-lit...t.html#faq-5.9
Cheers! --M
mlimber wrote: SGi wrote: I wonder if anyone here knew Pascal before C++, perhaps you could help me out. I'm converting some pascal code into C++, and I can't seem to understand what AType(Ptr)[index] is trying to accomplish. Any helps would be appreciated. Thanks.
type AType = array[0..$FF] of byte;
var Ptr : Pointer;
Move(AType(Ptr)[index], dest_word, 2);
This is a Pascal (or perhaps Delphi) question and should be asked in a more appropriate forum. See this FAQ for what is on-topic here and for some possible forums you can post in:
http://www.parashift.com/c++-faq-lit...t.html#faq-5.9
Cheers! --M
Don't just the gun, M. In the expression
Move(AType(Ptr)[index], ...
The part
AType(Ptr)[index]
is an explicit type conversion from 'Ptr' to 'AType' ("functional notation")
and then applying of the indexing operator to it.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
> AType(Ptr)[index] is an explicit type conversion from 'Ptr' to 'AType' ("functional notation") and then applying of the indexing operator to it.
Thanks a lot Vic.
Victor Bazarov wrote: mlimber wrote: SGi wrote: I wonder if anyone here knew Pascal before C++, perhaps you could help me out. I'm converting some pascal code into C++, and I can't seem to understand what AType(Ptr)[index] is trying to accomplish. Any helps would be appreciated. Thanks.
type AType = array[0..$FF] of byte;
var Ptr : Pointer;
Move(AType(Ptr)[index], dest_word, 2);
This is a Pascal (or perhaps Delphi) question and should be asked in a more appropriate forum. See this FAQ for what is on-topic here and for some possible forums you can post in:
http://www.parashift.com/c++-faq-lit...t.html#faq-5.9
Cheers! --M
Don't just the gun, M. In the expression [...]
But it's a *Pascal* expression!
Cheers! --M
Victor Bazarov wrote: mlimber wrote: SGi wrote: I wonder if anyone here knew Pascal before C++, perhaps you could help me out. I'm converting some pascal code into C++, and I can't seem to understand what AType(Ptr)[index] is trying to accomplish. Any helps would be appreciated. Thanks.
type AType = array[0..$FF] of byte;
var Ptr : Pointer;
Move(AType(Ptr)[index], dest_word, 2);
This is a Pascal (or perhaps Delphi) question and should be asked in a more appropriate forum. See this FAQ for what is on-topic here and for some possible forums you can post in:
http://www.parashift.com/c++-faq-lit...t.html#faq-5.9
Cheers! --M
Don't just the gun, M. In the expression
Move(AType(Ptr)[index], ...
The part
AType(Ptr)[index]
is an explicit type conversion from 'Ptr' to 'AType' ("functional notation") and then applying of the indexing operator to it.
Maybe that's the case. I don't know Pascal. Anyway, since we're not in a
Pascal group, this is off-topic.
mlimber wrote: Victor Bazarov wrote: mlimber wrote: SGi wrote: I wonder if anyone here knew Pascal before C++, perhaps you could help me out. I'm converting some pascal code into C++, and I can't seem to understand what AType(Ptr)[index] is trying to accomplish. Any helps would be appreciated. Thanks.
type AType = array[0..$FF] of byte;
var Ptr : Pointer;
Move(AType(Ptr)[index], dest_word, 2);
This is a Pascal (or perhaps Delphi) question and should be asked in a more appropriate forum. See this FAQ for what is on-topic here and for some possible forums you can post in:
http://www.parashift.com/c++-faq-lit...t.html#faq-5.9
Cheers! --M
Don't just the gun, M. In the expression [...]
But it's a *Pascal* expression!
Why do you think that? For all I know it's a C++ expression written
after four (three) lines of something that isn't C++. *If* we assume
that it's a C++ expression, my explanation holds, doesn't it? IOW,
I gave the interpretation of that expression _as_if_ it were a C++ one.
You, however, immediately dismissed it as non-C++ one. What's more
surprising, you managed to conclude that it *was* a Pascal expression
(and not a C++ expression). How the hell did you know? The expression
Move(AType(Ptr)[index], dest_word, 2);
looks like C++ to me. What led you to believe it wasn't?
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Rolf Magnus wrote: Victor Bazarov wrote:
mlimber wrote: SGi wrote: I wonder if anyone here knew Pascal before C++, perhaps you could help me out. I'm converting some pascal code into C++, and I can't seem to understand what AType(Ptr)[index] is trying to accomplish. Any helps would be appreciated. Thanks.
type AType = array[0..$FF] of byte;
var Ptr : Pointer;
Move(AType(Ptr)[index], dest_word, 2);
This is a Pascal (or perhaps Delphi) question and should be asked in a more appropriate forum. See this FAQ for what is on-topic here and for some possible forums you can post in:
http://www.parashift.com/c++-faq-lit...t.html#faq-5.9
Cheers! --M
Don't just the gun, M. In the expression
Move(AType(Ptr)[index], ...
The part
AType(Ptr)[index]
is an explicit type conversion from 'Ptr' to 'AType' ("functional notation") and then applying of the indexing operator to it.
Maybe that's the case. I don't know Pascal. Anyway, since we're not in a Pascal group, this is off-topic.
Another one! What makes you think that "Move(AType(Ptr)[index], .."
is not a C++ expression. For all I know about C++, that expression
surely looks like C++. I just explained what it is in C++. Did you
think otherwise? What gave you that idea?
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Victor Bazarov wrote: mlimber wrote: But it's a *Pascal* expression!
Why do you think that?
Because the OP said, "I'm converting some pascal code into C++, and I
can't seem to understand what AType(Ptr)[index] is trying to
accomplish," and then gave the Pascal definitions for AType and Ptr. It
may have looked like a duck, but in reality it was a goose!
Cheers! --M
Victor Bazarov wrote: mlimber wrote: Victor Bazarov wrote: mlimber wrote: SGi wrote: > I wonder if anyone here knew Pascal before C++, perhaps you could > help me out. I'm converting some pascal code into C++, and I can't > seem to understand what AType(Ptr)[index] is trying to accomplish. > Any helps would be appreciated. Thanks. > > type > AType = array[0..$FF] of byte; > > var Ptr : Pointer; > > Move(AType(Ptr)[index], dest_word, 2);
This is a Pascal (or perhaps Delphi) question and should be asked in a more appropriate forum. See this FAQ for what is on-topic here and for some possible forums you can post in:
http://www.parashift.com/c++-faq-lit...t.html#faq-5.9
Cheers! --M
Don't just the gun, M. In the expression [...]
But it's a *Pascal* expression!
Why do you think that? For all I know it's a C++ expression written after four (three) lines of something that isn't C++. *If* we assume that it's a C++ expression, my explanation holds, doesn't it? IOW, I gave the interpretation of that expression _as_if_ it were a C++ one. You, however, immediately dismissed it as non-C++ one. What's more surprising, you managed to conclude that it *was* a Pascal expression (and not a C++ expression). How the hell did you know? The expression
Move(AType(Ptr)[index], dest_word, 2);
looks like C++ to me. What led you to believe it wasn't?
Hm, I wonder what it is that makes believe that "Hand" in
"Hand me that book, please."
is English and not German. If someone would ask for the meaning of "Hand",
and gives that example sentence, would it be appropriate to say that "Hand"
is a noun in German that refers to those five-fingered things at the ends
of our arms?
Best
Kai-Uwe Bux
> Another one! What makes you think that "Move(AType(Ptr)[index], .." is not a C++ expression. For all I know about C++, that expression surely looks like C++. I just explained what it is in C++. Did you think otherwise? What gave you that idea?
Move((void*)static_cast<BYTE*>(Ptr)[index], &w, 2);
Almost pure C++...
Victor Bazarov wrote: Rolf Magnus wrote: Victor Bazarov wrote:
mlimber wrote: SGi wrote: > I wonder if anyone here knew Pascal before C++, perhaps you could > help me out. I'm converting some pascal code into C++, and I can't > seem to understand what AType(Ptr)[index] is trying to accomplish. > Any helps would be appreciated. Thanks. > > type > AType = array[0..$FF] of byte; > > var Ptr : Pointer; > > Move(AType(Ptr)[index], dest_word, 2);
This is a Pascal (or perhaps Delphi) question and should be asked in a more appropriate forum. See this FAQ for what is on-topic here and for some possible forums you can post in:
http://www.parashift.com/c++-faq-lit...t.html#faq-5.9
Cheers! --M
Don't just the gun, M. In the expression
Move(AType(Ptr)[index], ...
The part
AType(Ptr)[index]
is an explicit type conversion from 'Ptr' to 'AType' ("functional notation") and then applying of the indexing operator to it.
Maybe that's the case. I don't know Pascal. Anyway, since we're not in a Pascal group, this is off-topic.
Another one! What makes you think that "Move(AType(Ptr)[index], .." is not a C++ expression. For all I know about C++, that expression surely looks like C++. I just explained what it is in C++. Did you think otherwise? What gave you that idea?
The OP. He wanted some Pascal code converted to C++ and wanted to know how
to do that for a specific piece of code. And that piece was: > type > AType = array[0..$FF] of byte; > > var Ptr : Pointer; > > Move(AType(Ptr)[index], dest_word, 2);
So what gave you the idea that the last line is supposed to be C++? Just
that it looked like C++? Where would he get that line from without knowing
what it means if he wants to convert Pascal code to C++? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: s |
last post by:
Can I do this:
#define MYSTRING "ABC"
..
..
..
char mychar = MYSTRING;
..
..
..
|
by: Hagen |
last post by:
Hello,
in a recent thread "speed of vector vs array" I read about the problem
of the slow acces by addressing vector elements by indexing,
unfortunately I see no workaround in my case.
My...
|
by: Sid |
last post by:
Hi,
I was going through this reference code and playing around with it.
The code (shown below) shows a class that represents a stack of string
pointers
In the code below in particular in the...
|
by: trying_to_learn |
last post by:
im trying to index through an array that is member of a class using ptr
to member
in main i tried making a ptr to the member 'arr' :
const int * testclass7::* ptrToMemberIntPtr =...
|
by: qazmlp |
last post by:
size_t len = strlen( myCString ) ;
for( WHAT i = 0 ; i < len ; ++i )
{
// iterate through the string
// and do some operations
}
|
by: quek |
last post by:
Im having a problem passing a struct ptr.
Maybe someone could help me.
Heres what Visual C gives me as error:
error C2664: 'adpcm_coder_u' : cannot convert parameter 4 from 'struct
main::$S1 *'...
|
by: ravi |
last post by:
I have a situation where i want to free the memory pointed by a
pointer, only if it is not freed already. Is there a way to know
whether the memory is freed or not?
|
by: Jason |
last post by:
Hello,
could someone explain the difference to me inbetween:
*ptr++ and ++*ptr
Thankx a lot..
Jason.
|
by: Tubular Technician |
last post by:
Hello, World!
Reading this group for some time I came to the conclusion that
people here are split into several fractions regarding size_t,
including, but not limited to,
* size_t is the...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM).
In this month's session, the creator of the excellent VBE...
|
by: MeoLessi9 |
last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
|
by: Aftab Ahmad |
last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below.
Dim IE As Object
Set IE =...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
| |