Thanks for the answer.
I know pass by reference and pass by value, but haven't paied any attention to return by value and reture by reference before, and apparently they are two apples on the same...
Type: Posts; User: thinhare
Thanks for the answer.
I know pass by reference and pass by value, but haven't paied any attention to return by value and reture by reference before, and apparently they are two apples on the same...
Hello,
I am reading some c++ tutorial about operator overloading, and the following code given as an example for operator+ overloading has had me very much confused.
const MyClass...
I am writing a program to test if the file has been modified recently, and am thinking about how to implement it.
To know if a file has been changed, there has to be a reference to compared. My...
I don't get it. valenok.
After all, I know v is a pointer, and &v is a pointer, too, pointing to somewhere in the stack where v is stored. Thanks!
#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
#define va_start(ap,v) ( ap = (va_list)&v + _INTSIZEOF(v) )What type is of v? Not a pointer, I think, otherwise, there...
I don't think so. Because the size of the pointer here will be 4, unchanged. And that we expect, that needs to be plused, is the length of the string the pointer is pointing at, but not pointer...
Maybe I didn't make myself clear. You said "if sizeof fmt is 6", OK, there must be a way to count it so we can know about it. And what I doubt is the implementation in the STDARG.H in whihc it count...
yes, I agree with you. but the code in STDARG.H seems to be against what we think.
void minprintf(char *fmt, ...)
// Here we can see fmt is a pointer
va_start(ap, fmt);
// And the pointer...
#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
#define va_start(ap,v) ( ap = (va_list)&v + _INTSIZEOF(v) )What type is of v? Not a pointer, I think, otherwise, there...
you are damn right. ^_^
yes, but it doesn't say it will be initialized to 0 by default if no explicit initialization.
Thank you!!! kermit. I just got it proved. I referred to K&R "the c programming language" but it doesn't say anything about this.
Below, the code is from the book "Programming Windows" written by Charles Petzold. It sure can be compiled and run correctly. Something weird happened to the variable "fAngle".
void FillBuffer...
I just referred to msdn help and knew that lstrspy also deals with wide charactor, unicode.
lstrcpy is almost the same as strcpy. (Maybe, not very sure.)
And question here is, malloc(0) also returns a valid pointer but not NULL, so I am worrying when textOutput[0] = '\0', it is exactly...
It's hard to explain without the context in the code. I will paste them here.
Here I need to make sure one thing first. How to initial a variable as follows:
LPSTR textOutput = NULL;...
no error in compiling time, no error while running, but I just feel insecure. I tested the size of returned space, it was 4. don't know why not 0?????
what wrong with it?
char *space = NULL;...
Salem, the image in your profile is so much fun. I really like it.
As for the difference between debug and release build of MSVC, I have to say that it is the same for pointer initialization...
Thanks, Narf & Ancient Dragon.
Narf, since you just commented out _memset_ and didn't do anything about initialization, can I take that for it's not necesary to do so and can just leave it for...
To Quzah,
But the tabs are all inserted by editors, like MSVC or UltraEditor, not by myself. It's from so-called auto-indent function. Do you mean that I need replace them all with spaces by hand?
To Narf, sorry, I don't get your point. If memset is not needed, why calloc does the same thing?
Yes. I got it. I replied too quickly prior to reading through the posts.
but what do you mean by _not use tabs_?
Thank you dwks. I am correcting my code. There is not only one place where recursion is being used. I do need to rethink about it.
If the use of recursion is so dangerous, do you have any idea to make this done without recursion.
Explanation:
I want to display a column on the screen, which will be divided into many block...
Thank both of you.
Salem, your code seems much more reasonable than mine. I just moved a line out of WHILE loop since I don't think redefining a variable time and again and again is a good idea....