473,788 Members | 2,725 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What does this mean in C++ AType(Ptr)[index]

SGi
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);

Jun 2 '06 #1
11 2211
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

Jun 2 '06 #2
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
Jun 2 '06 #3
SGi
> 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.
Jun 2 '06 #4
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

Jun 2 '06 #5
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.

Jun 2 '06 #6
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
Jun 2 '06 #7
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
Jun 2 '06 #8
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

Jun 2 '06 #9
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
Jun 2 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

97
27822
by: s | last post by:
Can I do this: #define MYSTRING "ABC" .. .. .. char mychar = MYSTRING; .. .. ..
29
3984
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 case: class A {
5
1738
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 pop function, the code works when I set stack=0 but when I say delete stack the code compiles but does not execute -I am only trying to "delete stack" after I have copied the relevant data pointed by it into variable "rv", so why is this program...
2
1539
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 = &testclass7::arr; ------------------------------------------------------ the compiler cries: cannot convert from 'int (testclass7::*)' to 'const int *testclass7::* ' Types pointed to are unrelated; conversion requires reinterpret_cast,
4
1099
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 }
4
2433
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 *' to 'struct adpcm_state *' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
72
3634
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?
19
14943
by: Jason | last post by:
Hello, could someone explain the difference to me inbetween: *ptr++ and ++*ptr Thankx a lot.. Jason.
89
5772
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 right thing to use for every var that holds the number of or size in bytes of things. * size_t should only be used when dealing with library functions.
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10177
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10118
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8995
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5403
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4074
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2897
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.