Linux -Blue forest free software | Return to home page | Site Map | Search WWW | Contact Us |
Your current position : Homepage > Free Software > Technological exchanges >Application Programming


    

Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006


Null indicators used

I am sorry, language is always struggled in the passing line, huh, huh

In fact, there is no guideline as a different memory modules, all of the regional index in the first section of memory addresses.

The compiler is concerned, different types of indicators of semantics, the general understanding is that the size of memory can be indexed, such as indexing can be one byte char *, int * the index four bytes (2 bytes are some systems).

Guidelines need to pay attention to is a function of the type of transfer, as the transfer null parameters.

For example, int foo (a char *, int Chicken) 4003rd statement

Language inside the c-null ====== 0 4003rd I remember, the mind into C + +, behind apologized.

If the use of call foo ( "a", null);

So macro substitution for foo ( "a", 0), the transfer function in some compiler do type checking, therefore erroneous report, the type incompatible. When faced with such a compiler can use foo ( "a", (int *) 0).

Of course, not all there compiler warning or wrong, many of the now popular compiler will capture this common usage will be converted to 0 (int *) 0, (Note compiler quite make human happiness)

There is no need to pay attention not know where, following the Supreme added.

Null indicators used

Another Internet friend wrote this message in response to my article is separated from the original postings because the issues discussed have nothing to do with the debate below. To avoid affecting the original postings in the discussion, I cut it out into a patch independence.

=================================================

Fellow netizens, the concept of null indicator, please refer to the postings :

Http://www.lslnet.com/linux/#forum/viewtopic.php?t=404711

Ljttlf% target in the face of the interpretation is wrong (I did not see the other), we care. To avoid spreading the mistaken notion that I have already above that postings increase competency, for your reference.

Null indicators used

To "; Ljttlf

";>; Is a need to pay attention to the type of target function call, send null parameter.

";>; For example, int foo (a char *, int Chicken) 4003rd statement

";>; Language in which c-null ====== 0

Not null, only NULL

"Call the use ;>; if foo (" a ", null);

"So ;>; macro substitution for foo (" a ", 0), the transfer function in some compiler do type checking, therefore erroneous report, the type incompatible. When faced with such a compiler can use foo ( "a", (int *) 0).

If the use of foo ( "a", null); Naturally, it is wrong. If foo ( "a", NULL) would not be wrong, it would not be a warning.

"Of course, not all ;>; there compiler warning or wrong, many of the now popular compiler will capture this common usage will be converted to 0 (int *) 0, (Note compiler quite make human happiness)

If foo ( "a", 0), in most compiler that there has been no warning.
[color=red]c Language, the target of context, constant 0 null indicators for automatic conversion constants. [/color] So foo ( "a", 0) is completely legal, to meet the standards, not a little bit wrong. If not for the foo statement, except that if the variable is a function of the parameter, but also a different matter.

Null indicators used

Why wrong?
To be able to tell me why?

Null indicators used

I said no strict definition of the null message, you did not convince me that I do not have to produce evidence to convince you.

I say null rather than the strict definition of bugs, and you always say what I mean is null is the definition of bugs.

And this message, you said you did not see, ok, how can you say I was wrong characterization? ? Treat each hope withheld stringent view.

Null indicators used

I do do more harm the younger generation, are ignorant and incompetent!

Null indicators used

"So ;>; macro substitution for foo (" a ", 0)

NULL if you say the definition of strict, but in the vast majority of compiler, foo ( "a", NULL) will be launched for foo ( "a", (void *) 0) instead of foo ( "a", 0). I want to emphasize this is a mistake.

I did not say you ignorant and incompetent, as a matter of fact, if a person made such an ignorant and incompetent articles, I will not reasonable. Because nobody would listen to it. But you think that your recent articles discussing the development of a certain level, I think people will listen to you. As illustrated, for here I would like to have to come forward.

If my views are wrong, I came back to apologize.

Null indicators used

However, an argument being passed to a function is not necessarily recognizable as a pointer context. and the compiler may not be able to tell that an unadorned 0 ``means' 'a null pointer. To generate a null pointer in a function call context. an explicit cast may be required, to force the 0 to be recognized as a pointer. For example, the Unix system call execl takes a variable-length, null-pointer-terminated list of character pointer arguments. and is correctly called like this :

Execl ( "/bin/sh", "sh", "- c", "date", (char *) 0);
If the (char *) cast on the last argument were omitted, the compiler would not know to pass a null pointer. and would pass an integer 0 instead. (Note that many Unix manuals get this example wrong. )

Null indicators used

1, the example given is not such that you
2, I have added a sentence that the number of uncertain parameters, except
3, is NULL (void *) 0, NULL if using, the compiler would know it is a target.

Go to sleep.

Null indicators used

This is extracted from
Http://www.eskimo.com/~scs/C-faq/top.html
In short, here is comp.lang.c Frequently Asked Questions.
Which tells us that for the target environment, 0, and (void*) 0 is a concept.

Null indicators used

Why not this? That's what you have to be able to meet the ball?
I have not said that the function of the Senate is changing.

Since the compiler knows what is the target, then you tell me,

Why
Execl ( "/bin/sh", "sh", "- c", "date", (char *) 0);
Rather than
Execl ( "/bin/sh", "sh", "- c", "date", NULL);
Or
Execl ( "/bin/sh", "sh", "- c", "date", (void*) 0);
Not
Execl ( "/bin/sh", "sh", "- c", "date", 0);

You can not tell me that (char*) and (void*) is the same as the explanation.

Null indicators used

";>;c Language, the target of context, constant 0 null indicators for automatic conversion constants. So foo ( "a", 0) is completely legal, to meet the standards, not a little bit wrong

But here, "an argument being passed to a function is not necessarily recognizable as a pointer context. and the compiler may not be able to tell that an unadorned 0 ``means' 'a null pointer "


Attention is not necessarily recognizable as a pointer context.

Null indicators used

This is the original, right?

C programmers must understand that NULL pointer contexts[/color] [color=red]in and 0 are interchangeable. 0 is perfectly acceptable and that an uncast

[color=red] In execl, not pointer contexts! [/color]

Attention in pointer contexts

Null indicators used

No,
You can look at the original http://www.eskimo.com/~scs/C-faq/q5.2.html

Null indicators used

-->

I do, execl variable parameters is not, then what is? Man about.

Null indicators used

I said I was not foo :)

Moreover, on the original, and certainly if not now included in the variable parameters inside Azerbaijan.

Null indicators used

1, if the number of fixed parameters, a statement compiler know indicator.
2, if there is no statement, the compiler does not know indicator. Then not directly 0
3, if the declaration, but the number of variable parameters, the statement did not change the parameters with the same compiler not know what it is a target.

Foo your statement, so we can directly 0. Execl parameters are variable, not directly 0.

Null indicators used

";>; In execl, not pointer contexts!

Albanian, and if the pointer directly 0 contexts, which of course would not be a problem, but not here pointer contexts Ah, but function call contexts Albania (NULL, I started to remember the definition of the C + +%, 0% directly, Oh, that we are now discussing 0 goes, the target environment in which 0, and (void*) 0 same.

Null indicators used

5.2 means that a function call is now function call context, is no longer a pointer contexts Albania

Null indicators used

However, an argument being passed to a function is not necessarily recognizable as a pointer context. and the compiler may not be able to tell that an unadorned 0 ``means' 'a null pointer. To generate a null pointer in a function call context. an explicit cast may be required, to force the 0 to be recognized as a pointer.

Inside this sentence, you can come up
>;>;
1, if the number of fixed parameters, a statement compiler know indicator.
2, if there is no statement, the compiler does not know indicator. Then not directly 0
3, if the declaration, but the number of variable parameters, the statement did not change the parameters with the same compiler not know what it is a target.

Function call context also needs to meet these requirements?

Well, as you said foo () function call or points contexts contexts? Why?

If not modified for the transition 0 points contexts can be used directly, the function call is not used directly contexts. Well, if it is two points contexts, and the function call contexts state how common definition? in the end can not be used directly or 0?

If foo (), the use of 0, points contexts is only dependent on the state, and has nothing to do with the function call contexts, then I admit I was wrong.



 Privacy Policy  Copyright © 1999-2000 LSLNET.COM. All rights reserved. Blue Forest website owners. E-mail : Webmaster@lslnet.com