|
int is defined to be 32bit (not in the standard, but by common use)
CArray can theoretically hold more than 4Gig Items, at least in 64 bit Windows. That would need a 64 bit integer.
Here the INT_PTR kicks in: It defines a signed (there's also UINT_PTR) integer datatype that has at least the size to hold a pointer in the specific architecture.
So, in 64 bit Windows, it would be a 64 bit integer.
Raj Prathap wrote: Number of elements are int/long.
Actually, I would expect the count of elements in a collection to be a unsigned value. I can't imagine a use for a negative count.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
jhwurmbach wrote: Actually, I would expect the count of elements in a collection to be a unsigned value. I can't imagine a use for a negative count.
Error return, at least in a poorly designed implementation... For example, you call a function called PopulateCollection(...) , passing in the collection object and it returns an int value:
n > 0 -- collection now contains n elements
n == 0 -- collection now contains no elements
n < 0 -- error manipulating collection Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Very poor implementation. It would be mixing two concepts into one return value.
When manipulations are incorect, these manipulation-functions have to report faliure. In your example, the number of elements returned is only an additional gimmick, not the purpose of the function.
Asking for the number of elements can only return a number. There is no possible error case.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
As I said, a poor implementaiton1
jhwurmbach wrote: Asking for the number of elements can only return a number. There is no possible error case.
That actually depends on how the collection is being accessed. For example, suppose you have an object that warps a simple array. The object could be in a state where it is not yet associated with, or has been detached from, an array. Asking the object for the number of elements should return... What?
Returning zero means that the collection has a size of zero, not that there is no collection. Again, a poor implementation, but just because you cannot think of a good reason for doing something does not mean that others cannot think of many bad reasons for doing it!
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
James R. Twine wrote: The object could be in a state where it is not yet associated with, or has been detached from, an array. Asking the object for the number of elements should return... What?
0. No elements would be retrievable.
James R. Twine wrote: Returning zero means that the collection has a size of zero, not that there is no collection.
Why sould the "GetSize"-function answer a question other than that "How many elements are in the collection?". There are no elements to be retrieved, so the answer is null.
If your collection happens to have a state of being "invalid", there sould be another function to test that.
Note that I would have the actual access-routines return a proper error code.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
jhwurmbach wrote: 0. No elements would be retrievable.
Why sould the "GetSize"-function answer a question other than that "How many elements are in the collection?". There are no elements to be retrieved, so the answer is [zero].
The number of elements that are in a collection is not the same as the number of elements that are retrievable/available. GetSize() vs. GetAvailable(). The lot at the Aston Martin dealership contain 87 cars, but zero of them are available to me!
This is becoming a pointless argument - you will recall in my OP that I mention the words "poor design". And I have seen lots of poor designs and heard many ways of defending/rationalizing them.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
INT_PTR is NOT a pointer, it is an integer !
the _PTR at the end just means that this type is as large as a pointer type (32 bits on a 32 bits machine, 64 on a x64...)
|
|
|
|
|
how to read data from hard disk using int86() function??i have used the 0x13 interrupt and then passed
0x42 to a.h.ah.but m not too sure of wat m reading
prashant jain malviya national institute of technology
|
|
|
|
|
You probably should put your copy of Peter Nortons "Inside the IBM PC" (dated 1983) back into the shelf. MS-DOS 2.11 has recently been superseeded.
No kidding: You *are* using plain DOS here? Windows ( later than WinME even in the dos box) will not allow you to access the hardware direcly.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
jhwurmbach wrote: Peter Nortons "Inside the IBM PC" (dated 1983)
The book that started it all for me. There's a blast from the past
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I got my copy of that book still sitting on the shelf above my PC at home.
You never know when you need to look up some detail about the A20-Gate again!
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
prashantjain wrote: how to read data from hard disk using int86() function??
Wouldn't that require bypassing the HAL?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
can anybody help me in converting a 16 bit bmp to grayscale image.
Thanks in advance.
|
|
|
|
|
I think that you can use CxImage class. You can get the details from here[^]
A little bit of sample code is following -
CxImage image;
image.Load("image.bmp", CXIMAGE_FORMAT_BMP);
if (image.IsValid()){
if(!image.IsGrayScale()) image.IncreaseBpp(24);
image.SetJpegQuality(99);
image.Save("image.jpg",CXIMAGE_FORMAT_JPG);
}
|
|
|
|
|
hi all masters
please help me that how can i make an
connection to other system(machine) in a network
so that we can send messages to each other
thanks
|
|
|
|
|
I think that you need to create a client/server type application for that.
The server will reside on other network machine and will listen to some port.
The client will send data to the port to communicate with server.
|
|
|
|
|
NishantB++ is right.
You can start with WinSock (Socket programming ). you will find lots of material regarding Socker Programming in CP.
|
|
|
|
|
|
i have displayed a 3D cube in directX 8.0 (in VISUAL C++ - MFC). and i want to make rotate that using mouse, as per mouse moves. i have seen examples in ms sdk .
is there any other way to make rotate the 3D object using mouse?
|
|
|
|
|
I want to use a picture holder which is capable of holding any number of pictures and of any type. As the number of pictures keep on increasing it has a scroll bar. and as pictures are deleted the srollbar gets removed.
What i mean is that is should be dynamically increasing or decreasing.
I want this thing to be done as i am trying to make a desktop application as webshot.
Remember I am using MFC, VC++ 6.0 and not ATL so cannot use CImage class.
Thanks In Advance
DKS
|
|
|
|
|
If you can live with 32x32-Pixel thumbnails, CListCtrl in IconView can do what you want.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
what do u mean by CListCtrl in IconView can do what you want.
Can you just elaborate what u r trying to say.
Please.
Dhiraj Kumar Saini
|
|
|
|
|
The CListCtrl can be put in one of four modes. MSDN states:
"List view controls can display their contents in four different ways, called "views."
Icon view
Each item appears as a full-sized icon (32 x 32 pixels) with a label below it. The user can drag the items to any location in the list view window. "
This is what e.g. the Control-Panel shows when you set it to "Icon-View".
Using a mode Microsoft calls "virtual list view ctrl", your application can prepare the (32x32 pixel) thumbnails on demand.
The complete work of loading and resizing the pictures remains at your application, though.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
Hi to all,
I have written a code in C++ using VC6 compiler to transfer data at 'm_Bitrate' bps as follows,
if( cycle1[m_PID] != -1 )
{
do
{
Sleep(1);
Int64 cycles;
_asm rdtsc;
_asm lea ebx,cycles;
_asm mov [ebx],eax;
_asm mov [ebx+4],edx;
cycle2[m_PID] = cycles;
}while( (cycle2[m_PID]-cycle1[m_PID]) < (MachineCycPerSec*188*8*total_packs/m_Bitrate));
}
Int64 cycles;
_asm rdtsc;
_asm lea ebx,cycles;
_asm mov [ebx],eax;
_asm mov [ebx+4],edx;
cycle1[m_PID] = cycles;
But if I remove Sleep(1); statement, then I got approximate data transfer bitrate, but it takes maximum CPU utilization;
& if I add Sleep(1); statement, then CPU utilization is les, but transfer bitrate is very less than 'm_Bitrate' bps.
Is their any optimum solution here? OR
Is their any wrong logic used for data tranfer? OR
Any way to reduce CPU utilization (Sleep for less than 1 Millisecond)?
Please help.
Thanks in advance.
Thanks & Best Regards,
Aniket A. Salunkhe
|
|
|
|
|
You will never be able to achieve such precision: windows is not a real-time operating system, so, when you sleep for 1 msec, it can take up to 10 or 15 msec depending on the situation.
You could try to use WinCE, which is real-time.
|
|
|
|