Re: show disassembly
- From: "Alex Blekhman" <tkfx.REMOVE@xxxxxxxxx>
- Date: Fri, 30 May 2008 15:41:48 +0300
"Fil" wrote:
Is there something like VBE Ctrl+Shift+F8 to run in once the
content of the pow function?
Instead of pressing F11 (step into) you can press F10 (step over).
If you stepped in a function and want to go outside without
pressing F10 for each statement, then press Shift+F11.
Also, I suggest you to turn on shortcut keys display in tooltips.
Go to menu: Tools -> Customize..., then on "Toolbars" tab enable
"Show shortcut keys in ScreenTips" check box.
I thought I had to keep some space in the memory to store the
result of the function. Should I just write this:
int * mySortedArray;
mySortedArray=sortArray(myArray,sizeOfArray);
No, you don't need to allocate any space for sorted array. You
already have necessary space allocated. It is the space that
`myArray' occupies.
You don't need to return anyhting either. `myArray' is already
updated upon return from `sortArray':
// No need to specify array size, it will be inferred
// by the compiler from the initialization list.
// Necessary storage for myArray is allocated by
// the compiler on stack.
int myArray[]={6,3,5,7,1,2,4};
int sizeOfArray = sizeof(myArray)/sizeof(int);
// No need to return anything, myArray is passed by
// reference. All changes made within sortArray
// will be reflected in myArray.
sortArray(myArray, sizeOfArray);
Declaring all variables in the beginning of a function
considered
bad C-style, which is better to avoid in C++. Declare variables
as
close to their usage as possible.
That's cool because it will be easier to read, I was doing it
because I had
been told it was good style.
It is the only style for C language. However, C++ language doesn't
have this restriction.
You don't need to allocate new array.
But I am allocating for iResult, not for iArray. Shouldn't I?
You shouldn't. The necessary storage is already allocated for the
original `myArray' array. So, you can sort it in-place. No
additional space is required.
I think I have to study the allocation because it's not clear to
me when to use it or not.
You use dynamic allocations only if you need the allocated memory
to outlive current scope block. Keep reading you favourite C++
textbook, it is explained there for sure.
I am convinced most of the things I am coding already exist and
have been optimized through the years. I like to try to code
them by myself for exercise.
This is always good way to learn new things.
HTH
Alex
.
- References:
- Re: show disassembly
- From: William DePalo [MVP VC++]
- Re: show disassembly
- From: Fil
- Re: show disassembly
- From: Alex Blekhman
- Re: show disassembly
- From: Fil
- Re: show disassembly
- Prev by Date: Re: show disassembly
- Next by Date: Re: show disassembly
- Previous by thread: Re: show disassembly
- Next by thread: Re: show disassembly
- Index(es):
Relevant Pages
|
Loading