By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,221 Members | 1,663 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,221 IT Pros & Developers. It's quick & easy.

C++ implementation on segment model

P: n/a
As C++ program supports objects with
constructors/destructors/methods and data items, I'll assume
C++ implementation on segment model computer, like a 80286
with different access restrictions on code segment / data
segment / etc., will force all objects to be resided in a
code segment, so that executable code can be there as well
as data. And effectively bypassing all segment model.

Any comments on the above?

Stephen Wong @ Hong Kong.

Jul 22 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a

"Stephen S M WONG" <wo****@netvigator.com> wrote in message
news:Pi******************************@localhost.lo caldomain...
As C++ program supports objects with
constructors/destructors/methods and data items, I'll assume
C++ implementation on segment model computer, like a 80286
with different access restrictions on code segment / data
segment / etc., will force all objects to be resided in a
code segment, so that executable code can be there as well
as data. And effectively bypassing all segment model.

Any comments on the above?


Code is just code, and will always reside in the code segment. Data is just
data and will always reside in a data segment. You seem to think that
objects carry around little packets of code with them, but you are mistaken.

john
Jul 22 '05 #2

P: n/a
Then, on a segment model computer, methods will be
implemented by a table (virtual) placed in an object in a
data segment, and actual code is resided in code segment.
Am I right?

On a (pure) paging computer, methods (code) and data can be
intermingled in the user memory space. When an object with
inline methods is instantiated, the method code and data are
copied to a new memory location, that's my understanding of
method inheritance, anything wrong?

Stephen Wong @ Hong Kong.

On Tue, 24 Feb 2004, John Harrison wrote:

"Stephen S M WONG" <wo****@netvigator.com> wrote in message
news:Pi******************************@localhost.lo caldomain...
As C++ program supports objects with
constructors/destructors/methods and data items, I'll assume
C++ implementation on segment model computer, like a 80286
with different access restrictions on code segment / data
segment / etc., will force all objects to be resided in a
code segment, so that executable code can be there as well
as data. And effectively bypassing all segment model.

Any comments on the above?


Code is just code, and will always reside in the code segment. Data is just
data and will always reside in a data segment. You seem to think that
objects carry around little packets of code with them, but you are mistaken.

john

Jul 22 '05 #3

P: n/a

"Stephen S M WONG" <wo****@netvigator.com> wrote in message
news:Pi******************************@localhost.lo caldomain...
Then, on a segment model computer, methods will be
implemented by a table (virtual) placed in an object in a
data segment, and actual code is resided in code segment.
Am I right?
Right.

On a (pure) paging computer, methods (code) and data can be
intermingled in the user memory space. When an object with
inline methods is instantiated, the method code and data are
copied to a new memory location, that's my understanding of
method inheritance, anything wrong?


Code is never copied. One copy of the code is sufficient for the whole
program.

As I said, you seem to think that objects carry code with them, this is not
the case. Perhaps you would be interested in a book called 'Inside the C++
Object Model' by Stanley Lippman. I bit out of date now, but still a good
book apparently (haven't read it myself).

john
Jul 22 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.