|
Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006
Memset function using!
Memset why memset (buffer, NULL, sizeof (buffer)); The use of the time there will be a warning!
1714 : warning : passing arg 2 of `memset 'makes integer from pointer without a cast.
Before doing so, there is no problem?
This is the first document contains.
#include "Stdio.h>;
#include "Stdlib.h>;
#include "String.h>;
#include "Fcntl.h>;
#include "Sys/types.h>;
#include "Sys/socket.h>;
#include "Netinet/in.h>;
#include "Unistd.h>;
#include "Sys/time.h>;
#include "Pthread.h>;
Members prawn, which is how the case! ! |
Memset function using!
Memset (buffer, 0, sizeof (buffer)); |
Memset function using!
I know that you do not have this, I just want to ask what are the causes. |
Memset function using!
NULL is the value used with many null-pointer pointer operations and functions.
Void *memset (void *dest, int c, size_t count);
See the distinction? |
Memset function using!
No different, I asked what the reason that led to the use of NULL as the first two parameters memset when the newspaper warned. |
Memset function using!
Warning : passing arg 2 of `memset 'makes integer from pointer without a cast.
This is the reason,
If you do not understand.
Then there is nothing I can do.
Ydzqw put function prototypes are displayed for you, you do not understand.
Why not make a difference? ? ? ? ? ? ? ? ? ? ? ? ? ? |
Memset function using!
Memset function withheld is the first two parameters to be int型 is! This of course, I know, the problem is NULL does not necessarily mean air guideline, open system header file, the macro definition is NULL 0. Not
Memset (buffer, NULL, sizeof (buffer)); This will certainly be used warned that the majority of cases there is no problem, but I still come across two cases reported to the above warning. So, I suspect it is the first document that covers issues. |
Memset function using!
NULL on behalf of the general types of targets.
Although the macro is defined as 0, you can look at it as casual
0 cosmetic use. |
Memset function using!
OK, let us see how the case.
See where the definition of NULL
Find /usr/include/linux/stddef.h
Can see
#undef NULL
#if Defined (__cplusplus)
# NULL 0
#else
# NULL ((void *) 0)
#endif
This should solve your puzzles under the bar.
I think the best reduction in the paper just NULL |
Memset function using!
Deep held NULL
Enter /usr/include
Grep "define NULL" * r
NULL have seen many definitions, and sometimes defined as 0, sometimes defined as (void*) 0.
For example, 327 firms tcl.h
#ifndef NULL
# NULL 0
#endif
Only here defined as 0, NULL seems to be not to use. Included in the first document, NULL different definition. |
Memset function using!
-->
In fact, even a wrong message that no target has been a cosmetic change.
But first see someone using NULL-0. Ah warning |
Memset function using!
Since the definition in the source document or head inside I have tried to redefine the definition of the error will be reported plots! |
Memset function using!
I have said
Char buffer[256];
Memset (buffer, NULL, sizeof (buffer));
Not necessarily being given the contrary, the vast majority of cases, this approach has not given compiler warnings, I just find it very strange to ask what is this? If not allowed to do so, cc, gcc compiler should be given a warning. I just want to know why, in the end is what led to the same compiler, science and technology funds up mutual translation of the results of two different! |
Memset function using!
Landlord do not think memset (buffer, NULL, sizeof (buffer)); Write very strange?
I have never written so, I usually memset (buffer, SEEK_SET, sizeof (buffer)); The.
Since then NULL=0 on =NULL 0, 0 SEEK_SET=0 also =SEEK_SET so that other people can read read!
Suggest to read more. H documents, all of the places that are used with a wide range of constant equivalent definition brought in to write anyone unable to read, unable to read the hieroglyphics himself couple of days later and work hard! |
Memset function using!
As written above normal, we do outsourcing, customer demand is clear to me the coding rules written. This will leave just felt that the back and forth so much controversy that always seems no substantive progress, I just know what led to a different result in the translation. |
Memset function using!
And the first order may be cited in the document, cited in the first document contains a number of macro definitions, the definition of inconsistency may lead to NULL; Another different compiler warning level of acquiescence is not the same, some will be overlooked, some would suggest. Dual graduation design is then written in SunOS on the cc's advice did not suggest a lot of the Linux gcc warning |
Memset function using!
Will be NULL (4 bytes, 0x00000000) as a '\0' (1 byte 0x00) course with a warning. |
Memset function using!
Croatian brothers to think back, welcome, welcome. . . : D |
Memset function using!
Win-hate illustrated.
I will give you the letter.
Afternoon OFFICE nothing back.
CU at a very slow change. There? |
Memset function using!
The landlord, you will be able to clear the circumstances in which translation, without warning, the circumstances under which a compiler warning? |
| |