Can some one guide me what is word boundary?
google is no good for me for this
thanks in advance 14 19185
I just took c++ exam in brainbnch . one of the question is
Q:)According to the C++ standard, what is an object's internal
representation in memory guaranteed to be?
Choice 1 : Contiguous
Choice 2 : On the stack
Choice 3 : Initialized
Choice 4 : On a word boundary
Choice 5 : On the heap
Even one of the c++ technical test for a company was asking the same
question.
In fact in Google there are many c++ sites talking about problems with word
boundary.
hope you are convinced.
Regards,
S
ignorance is bliss
"Jack Klein" <ja*******@spam cop.net> wrote in message
news:fm******** *************** *********@4ax.c om... On Sun, 18 Sep 2005 00:15:43 +0100, "Singleton" <ku*****@homeca ll.co.uk> wrote in comp.lang.c++:
Can some one guide me what is word boundary? google is no good for me for this thanks in advance
What made you decide to ask this question here? There is no such term defined by the C++ language.
-- Jack Klein Home: http://JK-Technology.Com FAQs for comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html comp.lang.c++ http://www.parashift.com/c++-faq-lite/ alt.comp.lang.l earn.c-c++ http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Hi,
It depends on how large a word is. On a lot of machines today a word is 32
bit. That means on a word boundary is at address
0
4
8
12
16
etc...
ten years ago or so a word used to be 16 (8086) bits and before that 8 bit
was common (6502, 6800, 6809)
Usually there is a bit of a performance gain working with the processors
native size. So using 32 bits and memory addresses that are on a word
boundary can be more efficient. than memory addresses at non-32 bit -16 bit
or even non 32- non- 16 but 8 bit addresses even the latter is smaller you
might end up with slower code when using those sizes and addresses . in your
code.
--
Regards, Ron AF Greve http://moonlit.xs4all.nl
"Singleton" <ku*****@homeca ll.co.uk> wrote in message
news:43******** **@mk-nntp-2.news.uk.tisca li.com... Can some one guide me what is word boundary? google is no good for me for this thanks in advance
"Singleton" writes: I just took c++ exam in brainbnch . one of the question is
Q:)According to the C++ standard, what is an object's internal representation in memory guaranteed to be? Choice 1 : Contiguous Choice 2 : On the stack Choice 3 : Initialized Choice 4 : On a word boundary Choice 5 : On the heap
In that context, a word is the natural/native amount of data fetched from
memory on a single access by a CPU. A sampling of some of the word sizes
over the years (in bits per word): 6, 8, 15, 16, 18, 24, 30, 32, 36, 51, 60.
And a great many more.
Singleton wrote: Can some one guide me what is word boundary? google is no good for me for this thanks in advance
The size of an int in a C++ compiler should be the same as the size of
a word for the architecture that that compiler targets.
A word is supposed to be the "natural" size in which the computer
ordinarily processes data. For most computers these days that would be
32 bits. So a word boundary on most machines would occur every four
bytes in memory and start at a byte address evenly divisible by 4.
Greg
"Greg" <gr****@pacbell .net> wrote in message
news:11******** *************@g 49g2000cwa.goog legroups.com Singleton wrote: Can some one guide me what is word boundary? google is no good for me for this thanks in advance
The size of an int in a C++ compiler should be the same as the size of a word for the architecture that that compiler targets.
A word is supposed to be the "natural" size in which the computer ordinarily processes data. For most computers these days that would be 32 bits. So a word boundary on most machines would occur every four bytes in memory and start at a byte address evenly divisible by 4.
Greg
On Windows, a WORD is 16 bits on 32 bit machines. A DWORD (double word) is
32 bits.
This may well be because a WORD was 16 bits on earlier 16 bit versions of
Windows and its size has been left at 16 bits for backward compatibility
reasons.
--
John Carson
John Carson wrote: "Greg" <gr****@pacbell .net> wrote in message news:11******** *************@g 49g2000cwa.goog legroups.com Singleton wrote: Can some one guide me what is word boundary? google is no good for me for this thanks in advance
The size of an int in a C++ compiler should be the same as the size of a word for the architecture that that compiler targets.
A word is supposed to be the "natural" size in which the computer ordinarily processes data. For most computers these days that would be 32 bits. So a word boundary on most machines would occur every four bytes in memory and start at a byte address evenly divisible by 4.
Greg
On Windows, a WORD is 16 bits on 32 bit machines. A DWORD (double word) is 32 bits.
This may well be because a WORD was 16 bits on earlier 16 bit versions of Windows and its size has been left at 16 bits for backward compatibility reasons.
-- John Carson
Yes, but size of the "int" type in C++ is the one that has to match the
size of a machine word. longs, shorts, and especially typedefs may or
may not match.
In fact the reason that WORD and DWORD exist are to insulate C++ source
code from changes in the size of an int. After all, an int is the type
which is the mostly like to change in size. As it did when the platform
moved from 16 to 32 bits, and presumably will again when it moves from
32 to 64 bits. By using typedefs for integer types, the programmer can
be assured of constant sizes. It allows the programmer to be able to
decide when and how to make the transition to the larger types, instead
of having to do it one day after installing the latest C++ compiler.
Greg
"Greg" <gr****@pacbell .net> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.com John Carson wrote: "Greg" <gr****@pacbell .net> wrote in message news:11******** *************@g 49g2000cwa.goog legroups.com Singleton wrote: Can some one guide me what is word boundary? google is no good for me for this thanks in advance
The size of an int in a C++ compiler should be the same as the size of a word for the architecture that that compiler targets.
A word is supposed to be the "natural" size in which the computer ordinarily processes data. For most computers these days that would be 32 bits. So a word boundary on most machines would occur every four bytes in memory and start at a byte address evenly divisible by 4.
Greg
On Windows, a WORD is 16 bits on 32 bit machines. A DWORD (double word) is 32 bits.
This may well be because a WORD was 16 bits on earlier 16 bit versions of Windows and its size has been left at 16 bits for backward compatibility reasons.
-- John Carson
Yes, but size of the "int" type in C++ is the one that has to match the size of a machine word. longs, shorts, and especially typedefs may or may not match.
In fact the reason that WORD and DWORD exist are to insulate C++ source code from changes in the size of an int. After all, an int is the type which is the mostly like to change in size. As it did when the platform moved from 16 to 32 bits, and presumably will again when it moves from 32 to 64 bits. By using typedefs for integer types, the programmer can be assured of constant sizes. It allows the programmer to be able to decide when and how to make the transition to the larger types, instead of having to do it one day after installing the latest C++ compiler.
Greg
I agree with most of what you say, but in the interests of accuracy would
point out:
1. The distinction that you wish to make between word (lowercase) and the
typedef WORD (uppercase) is not one that is maintained in Windows
programming. I am not defending Windows terminology, just pointing it out.
See here for example: http://msdn.microsoft.com/library/de...ros/loword.asp
2. 64 bit Windows is already here and an int is still 32 bits (a
controversial decision that could easily have gone the other way, but there
you have it).
--
John Carson
"Singleton" <ku*****@homeca ll.co.uk> wrote in message
news:43******** **@mk-nntp-2.news.uk.tisca li.com... I just took c++ exam in brainbnch . one of the question is
Q:)According to the C++ standard, what is an object's internal representation in memory guaranteed to be? Choice 1 : Contiguous Choice 2 : On the stack Choice 3 : Initialized Choice 4 : On a word boundary Choice 5 : On the heap
The correct answer is Choice 6: None of the above.
Objects with virtual base classes are not always contiguous, which rules out
(1).
The word "stack" appears in the C++ standard only in the context of "stack
unwinding" that occurs as part of exception handling, and in the
descriptions of the library algorithms that deal with stacks.
Objects are not guaranteed to be initialized.
The phrase "word boundary" appears nowhere in the C++ standard.
The word "heap" appears in the C++ standard only in the context of
describing the library algorithms that deal with heaps. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Michael Kalina |
last post by:
Because when I asked for comments on my site-design (Remember? My site,
your opinion!) some of you told me never to change anything on
font-sizes!
What do you guys think of that: http://www.clagnut.com/blog/348/
I hope that's going to be a good discussion!
Michael
|
by: L. Chen |
last post by:
The standard says that a char* or void* pointer has the least strict
alignment. But I do not know what is a strict alignment. What does that
mean?
|
by: Vijay Kumar R. Zanvar |
last post by:
Hello,
I have few questions. They are:
1. Is "const char * const *p;" a valid construct?
2. How do I align a given structure, say, at 32-byte boundary?
3. Then, how do I assert that a given object is aligned, say,
at 32-byte boundary?
|
by: Muhammad Farooq-i-Azam |
last post by:
Hi,
I am trying to define an arp structure but having problem
doing so. I think I have define the correct arp structure but
I find myself in a strange problem. The size of structure that
I have defined is 28 bytes, but it is reported to be 32 bytes by
the sizeof() call.
Interestingly, sum of individuals members of the sturcture is 28.
However, the sizeof() the entire structure is returned to be 32.
|
by: Aj Blosser |
last post by:
Hey guys, I have a question for you,
I have a setup where I'm sending files through the POST to a php web page, I
read the file contents, put that file contents as text into the POST string,
and send it on it's way.
it works perfectly for text files. However, I can't open a word document
like a text file and have it give me the result I need. I'm looking for a
way to just open a word document and get all the values in it like you would...
| |
by: Xah Lee |
last post by:
in March, i posted a essay “What is Expressiveness in a Computer
Language”, archived at:
http://xahlee.org/perl-python/what_is_expresiveness.html
I was informed then that there is a academic paper written on this
subject.
On the Expressive Power of Programming Languages, by Matthias
Felleisen, 1990.
http://www.ccs.neu.edu/home/cobbe/pl-seminar-jr/notes/2003-sep-26/expressive-slides.pdf
|
by: David |
last post by:
Hi,
Could PHP be used to take a txt file (or set of txt files) and add a
string of characters every X number of words or characters?
Say a txt file with 50,000 characters/5,000 words how would you go
about adding a string of characters every 5,000 characters or 500
words.
To improve on this I'd want to if using characters as the guide to use
|
by: Gary Bond |
last post by:
Hi All,
Being a bit of a newbie with regex, I am confused when using word boundaries.
For instance, I want to replace all the stand alone '.5k' that occur in an
input string, with 500. In other words
"this is a .5k example" goes to "this is a 500 example"
The replace should not touch '.5k' that occurs inside a word. For example:
|
by: Avi |
last post by:
Hi all,
I'm using string Replace(string oldValue, string newValue) and would like it
to replace only full words that matches oldValue and not when oldValue is a
substring of a larger word.
How can it be done?
Thanks,
Avi
|
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,...
|
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...
| |
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,...
|
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...
|
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 projectplanning, coding, testing, and deploymentwithout 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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |