472,789 Members | 1,110 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,789 software developers and data experts.

what's the difference between value-initialization and default-initialization?

Hello,

I understand the default-initialization happens if we don't initialize
an object explicitly. I think for an object of a class type, the
value is determined by the constructor, and for the built-in types,
the value is usually garbage. Is this right?

However, I'm a bit confused about value-initialization, when does it
happen, and what kind of values are assigned to objects?

Thanks.

Apr 25 '07 #1
23 3553
Jess wrote:
Hello,

I understand the default-initialization happens if we don't initialize
an object explicitly. I think for an object of a class type, the
value is determined by the constructor, and for the built-in types,
Not only built-in types but POD (plain old data) types.
the value is usually garbage. Is this right?
Yes, unless you use a () in your initialization of the POD members/data.
>
However, I'm a bit confused about value-initialization, when does it
happen, and what kind of values are assigned to objects?
You assign whatever value type you enable. Usually, a class has a copy
constructor and an assignment operator available.

i.e.

struct Z
{
Z() {} // YYY
Z( const char * ) {}
Z & operator=( const char * ) {} // XXX
};

Z x( "HI" );

Z y( x ); // copy constructor (compiler provided YYY)

int main()
{

y = x; // assignment operator (compiler provided)

y = "THERE"; // assignment operator XXX

}
Apr 25 '07 #2
Not only built-in types but POD (plain old data) types.

What is POD?
Yes, unless you use a () in your initialization of the POD members/data.
Again, could you please give more explanation?
You assign whatever value type you enable. Usually, a class has a copy
constructor and an assignment operator available.

i.e.

struct Z
{
Z() {} // YYY
Z( const char * ) {}
Z & operator=( const char * ) {} // XXX

};

Z x( "HI" );

Z y( x ); // copy constructor (compiler provided YYY)

int main()
{

y = x; // assignment operator (compiler provided)

y = "THERE"; // assignment operator XXX

}
It'd be very helpful if you could explain the example. Thanks a lot!

Apr 26 '07 #3
On 04/25/2007 12:11 AM, Jess wrote:
Hello,

I understand the default-initialization happens if we don't initialize
an object explicitly. I think for an object of a class type, the
value is determined by the constructor, and for the built-in types,
the value is usually garbage. Is this right?

However, I'm a bit confused about value-initialization, when does it
happen, and what kind of values are assigned to objects?

Thanks.

#include <cstdio>
#include <cstdlib>

class Foo {
public:
int value;
const char * str;

void print (FILE * fh) {
fprintf(fh, "%d =%s\n", value, str);
}
};

int main ()
{
Foo myfoo = { 10, "Hello" };
myfoo.print(stdout);

return EXIT_SUCCESS;
}

-----end-code--------

Notice that myfoo was initialized by values written in the style used to
initialize POD (plain old data--known in C as 'structs').

Apr 26 '07 #4
Jess wrote:
Not only built-in types but POD (plain old data) types.

What is POD?
Google "POD (plain old data)" - here is an "I'm Feeling Lucky Link"

http://www.google.com/search?hl=en&q...=Google+Search
>
>Yes, unless you use a () in your initialization of the POD members/data.
Again, could you please give more explanation?

Consider this:

struct A { int x; A() : x() {} };

struct B { int x; };

int main()
{
A a;
B b;

return a.x == b.x;
}

The value of a.x is always 0. The value of b.x is indeterminate or
uninitialized.

This applies for all POD types.

B is a POD type;

consider:
B b( B() );

.... b.x is now initialized.

Note that if you had written:
B b(); // function declaration of function b() returning a B.
.... nasty little issue for newbies...

>
>You assign whatever value type you enable. Usually, a class has a copy
constructor and an assignment operator available.

i.e.

struct Z
{
Z() {} // YYY
Z( const char * ) {}
Z & operator=( const char * ) {} // XXX

};

Z x( "HI" );

Z y( x ); // copy constructor (compiler provided YYY)

int main()
{

y = x; // assignment operator (compiler provided)

y = "THERE"; // assignment operator XXX

}
It'd be very helpful if you could explain the example. Thanks a lot!
You need to read the chapter on constructors in C++ in your favorite
book and come back.
Apr 26 '07 #5
On Apr 25, 7:11 am, Jess <w...@hotmail.comwrote:
I understand the default-initialization happens if we don't initialize
an object explicitly. I think for an object of a class type, the
value is determined by the constructor, and for the built-in types,
the value is usually garbage. Is this right?
Written with a hyphen, no. "default-initialization" is a
technical term, defined and used in the standard:

To default-initialize an object of type T means:

-- if T is a non-POD class type (clause 9), the default
constructor for T is called (and the initialization
is ill-formed if T has no accessible default
constructor);

-- if T is an array type, each element is
default-initialized;

-- otherwise, the object is zero-initialized.

Note, however, that variables aren't default-initialized by
default:-).
However, I'm a bit confused about value-initialization, when
does it happen, and what kind of values are assigned to
objects?
Again, a technical term used in the standard (or at least the
latest draft). I'll admit that when reading the standard, I
can't quite make out what the intended difference between
default initialization and value initialization is supposed to
be. The original version (ISO 14882:1998) doesn't have value
initialization.

I suspect that the intent is to ensure that zero initialization
occurs when the type has a non trivial implicit constructor.
The exact wording is:

To value-initialize an object of type T means:

-- if T is a class type (clause 9) with a user-declared
constructor (12.1), then the default constructor for
T is called (and the initialization is ill-formed if
T has no accessible default constructor);

-- if T is a non-union class type without a
user-declared constructor, then every non-static
data member and baseclass component of T is
value-initialized;

-- if T is an array type, then each element is
value-initialized;

-- otherwise, the object is zero-initialized

Basically, what gets added is the second point. If I have a
class something like:

class C
{
public:
virtual ~C() {}
int x ;
} ;

It's not a POD, but it doesn't have a user defined
constructor, so value-initialization guarantees that x is
set to 0, whereas default-initialization doesn't.

And to quote the standard: "An object whose initializer is
an empty set of parentheses, i.e. () shall be
value-initialized." (In the latest draft;
default-initialized in the 1998 version of the standard.)

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orient閑 objet/
Beratung in objektorientierter Datenverarbeitung
9 place S閙ard, 78210 St.-Cyr-l'蒫ole, France, +33 (0)1 30 23 00 34

Apr 26 '07 #6
James Kanze wrote:
>
Note, however, that variables aren't default-initialized by
default:-).
One of the most stupid features of C++. Variables aren't always
default-initialized.
>
I suspect that the intent is to ensure that zero initialization
occurs when the type has a non trivial implicit constructor.
The exact wording is:
Well, more specifically, it makes the behavior consistent when
the object contains objects of possibly non-POD type. Before
this concept was defined you couldn't figure out how:

struct S {
int i;
T t;
} s;

would be initialized unless you knew what T was.
Apr 26 '07 #7
On Apr 26, 7:13 pm, Gianni Mariani <gi3nos...@mariani.wswrote:
struct A { int x; A() : x() {} };

struct B { int x; };

int main()
{
A a;
B b;

return a.x == b.x;

}

The value of a.x is always 0. The value of b.x is indeterminate or
uninitialized.
This is called default-initialization, right?
consider:
B b( B() );

... b.x is now initialized.
I don't quite understand this... "B()" creates a temporary object and
it's passed to a copy-constructor to initialize "b", and the copy
constructor tries to copy "x" value of the tmp object to "b"'s "x".
However, what is the value of tmp object's "x"?
You need to read the chapter on constructors in C++ in your favorite
book and come back.
I did read Accelerated C++, but am still confused. In order to
clarify the matter, here's what I think, not sure whether they are
right/wrong:

1. Default initialization is used when we create an object using the
form "T t", where T can be a POD type or class type. If this happens,
the following occurs:
a. if T is POD, then "t" is garbage value
b. if T is class, then it's default constructor is invoked. If
there's no default contructor, the compiler will synthesize one.
(i). If there's a default constructor, then all T's POD member data is
initialized according to the constructor initializer list; any POD
member not mentioned in the initializer list gets default-init, with
garbage value. If T has a class-typed member (say of type A), then
A's default constructor is called and if A has no default constructor,
then the synthesized constructor will be called. FInally, the
constructor's body is entered.
(ii). If there is no default constructor, then the synthesized
constructor will be called. All POD member gets garbage data and
class members have their default constructor (or synthesized default
constructors) invoked.

Is this what happens to default-init? Moreover, to init POD member in
the constructor initializer, I can do things like "x(10)" and also
"x()" where "x" is an int, is this right? If "x()" is used, then "x"
gets value-init to 0?

2. Value-initialization happens if a constructor is explicitly invoked
like "T t(arg)", or when we invoke copy constructor. For a class type
object:
a. if it's created by invoking a constructor like "T t(arg)", then all
its POD member gets initialized according to the constructor
initializer; any POD member not mentioned gets value-init to 0. But
what happens to those class-typed members? Are their default
constructors (or synthesized one) called? I think after all these are
done, the constructor's body is entered.
b. if the T object is created through copy constructor, then the
values of the existing objects are copied into the new object.
However, what if we have an example like "B b(B())"? what's the value
of the tmp object?

3. To value-init a POD object, I think the only way is to do something
like:

int n = int();
is this right?

4. The book Accelerated C++ also says that if an object is used to
init a container element, either as a side effect of adding new
element to a "map", or as the elements of a container defined to have
a given size, then the members will be value-initialized. I checked
it through an example,

struct A{
int x;
};

int main(){
A a[10];
return 0;
};

Then I found out each element in a has it's "x" value as 0. I think
this is what the author of the book meant. Then I tried another
example:

int main(){
int b[10];
return 0;
}

This time, each element in b has garbage value. Isn't each member of
b supposed to be value-init to 0?

I'd really appreciate it if some of you could answer my questions and
point out my mistakes and also let me know the points I overlooked.
Thanks.
Jess
Apr 29 '07 #8
Jess wrote:
On Apr 26, 7:13 pm, Gianni Mariani <gi3nos...@mariani.wswrote:
>consider:
B b( B() );

... b.x is now initialized.

I don't quite understand this... "B()" creates a temporary object [..]
B b(B());

is a declaration of a funciton. There is no b.x. 'b' is a function.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Apr 29 '07 #9
On Apr 30, 2:13 am, "Victor Bazarov" <v.Abaza...@comAcast.netwrote:
B b(B());

is a declaration of a funciton. There is no b.x. 'b' is a function.
But in your previous message, you mentioned "b.x" is initialized?
Also, "B()" calls B's default constructor, and the result is a B
object. When we use this temporary object to "B b(B())", aren't we
calling the copy-constructor?

Thanks
Jess

May 1 '07 #10
Jess wrote:
On Apr 30, 2:13 am, "Victor Bazarov" <v.Abaza...@comAcast.netwrote:
> B b(B());

is a declaration of a funciton. There is no b.x. 'b' is a function.

But in your previous message, you mentioned "b.x" is initialized?
Also, "B()" calls B's default constructor, and the result is a B
object. When we use this temporary object to "B b(B())", aren't we
calling the copy-constructor?
You can't call constructors, constructors are called by object creation.
The above is not an object creation. It's a definition of a function
called "b' which takes a paramter of type B and returns B.
May 1 '07 #11
* Ron Natalie:
Jess wrote:
>On Apr 30, 2:13 am, "Victor Bazarov" <v.Abaza...@comAcast.netwrote:
>> B b(B());

is a declaration of a funciton. There is no b.x. 'b' is a function.

But in your previous message, you mentioned "b.x" is initialized?
Also, "B()" calls B's default constructor, and the result is a B
object. When we use this temporary object to "B b(B())", aren't we
calling the copy-constructor?

You can't call constructors, constructors are called by object creation.
Sort of. You might argue that that statement is purely about
terminology. But even so, the standard uses the terms "call" and
"invoke", the language's creator does so, I do so, and in short, the
statement is just plain wrong no matter whether it's about what one can
do or about established terminology.

An accurate statement is that outside a constructor initializer list you
can't call a constructor on existing storage, except by using low-level
(not type safe) shenanigans[1].

A more useful but not quite as accurate statement is that with at least
one user-defined constructor C++ effectively provides a construction
guarantee where each object (including each sub-object) receives exactly
one constructor call, which happens before anything else.

The above is not an object creation. It's a definition of a function
called "b' which takes a paramter of type B and returns B.
Right.

And the reason has nothing to do with constructor calls, but with an
ambiguity in the grammar, which the standard requires is always resolved
in favor of a function declaration, if possible.

By including additional parentheses an interpretation as a function
declaration is no longer possible,

B b((B()));

but there's a limit to how subtle code one should write, so it's better
to do the straightforward

B b;

or, in some contexts,

B b = B();

Cheers,

- Alf
Notes:
[1] Low-level shenanigans include in-place construction.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
May 1 '07 #12
On May 1, 11:40 pm, "Alf P. Steinbach" <a...@start.nowrote:
but there's a limit to how subtle code one should write, so it's better
to do the straightforward

B b;

or, in some contexts,

B b = B();
Doesn't the latter require an accessible copy constructor?

May 1 '07 #13
On 5月1日, 下午9时40分, "Alf P. Steinbach" <a...@start.nowrote:
The above is not an object creation. It's a definition of a function
called "b' which takes a paramter of type B and returns B.

Right.
So "B b(B());" is a definition of "b"? Then it's return type is "B"
and its argument type "looks like" B to me. I'm saying it "looks
like" "B" because it's paramenter is "B()" instead of the standard
format like "type arg". Moreover, if this is a definition of "b",
then why can I receive a B object after this execution, where's the
invocation of the function "b"?
but there's a limit to how subtle code one should write, so it's better
to do the straightforward

B b;

or, in some contexts,

B b = B();
I think the default constructor is called in the first case. For the
second case, a default constructor is called for "B()", then a copy-
constructor is called (by the compiler) to copy the "B" to a temporary
result, and then another copy-constructor is called to copy the
temporary B object to "b" to initialize "b", is this right? In terms
of value-initialization and default-initialization, are these two
examples the same? I think the first one looks like default-init and
the second one looks like value-init. I'm still not quite sure about
the differences.

Could someone answer my questions that I posed earlier and point out
whether I've made mistakes about value- and defaul-initialization? :)
Perhaps I should start a new thread in case it's not obvious what my
questions are. :)

May 1 '07 #14
On May 2, 11:51 am, Jess <w...@hotmail.comwrote:
On 5月1日, 下午9时40分, "Alf P. Steinbach" <a...@start.nowrote:
The above is not an object creation. It's a definition of a function
called "b' which takes a paramter of type B and returns B.
Right.
Must have been a long day for Ron and Alf. The parameter to 'b'
has type 'pointer to function taking no arguments and returning B'.
It is the same as:
B b( B (*)() );
So "B b(B());" is a definition of "b"? Then it's return type is "B"
and its argument type "looks like" B to me.
Looks can be deceiving :)
I'm saying it "looks like" "B" because it's paramenter is "B()"
instead of the standard format like "type arg".
"type arg" is not a "standard format". Some simple declarations
look like that, but the syntax for declarations is more complicated,
with "arg" sometimes coming in between different parts of "type".
For example, int x[5]
Moreover, if this is a definition of "b", then why can I receive a B
object after this execution, where's the invocation of the function "b"?
Huh? (Post some code to illustrate what you mean).
but there's a limit to how subtle code one should write, so it's better
to do the straightforward
B b;
or, in some contexts,
B b = B();

I think the default constructor is called in the first case. For the
second case, a default constructor is called for "B()", then a copy-
constructor is called (by the compiler) to copy the "B" to a temporary
result, and then another copy-constructor is called to copy the
temporary B object to "b" to initialize "b", is this right?
You have one step too many (I think). A temporary object is default-
constructed, and then 'b' is copy-constructed from that object.

May 2 '07 #15
Alf P. Steinbach wrote:
Sort of. You might argue that that statement is purely about
terminology.
And the standard has non-ambiguous terminology.
But even so, the standard uses the terms "call" and
"invoke",
But doesn't refer to programs being able to call constructors. It
specifically states to the contrary.

I don't see why you insist on continually inserting this non-sequitor
incorrect argument in discussions. It just confuses the issue.
>
An accurate statement is that outside a constructor initializer list you
can't call a constructor on existing storage, except by using low-level
(not type safe) shenanigans[1].
You can't even do it inside a constructor initializer list (if you're
talking about the mem-init list), the belief that such a list is a
constructor call further confuses the fact that the mem-initializers
have no bearing at all on constructor invocation order.
>
A more useful but not quite as accurate statement is that with at least
one user-defined constructor C++ effectively provides a construction
guarantee where each object (including each sub-object) receives exactly
one constructor call, which happens before anything else.
That is correct IF you remove the words user-defined.
>
And the reason has nothing to do with constructor calls, but with an
ambiguity in the grammar, which the standard requires is always resolved
in favor of a function declaration, if possible.
Correct, but the original poster thought he was calling a constructor
which isn't true by either yours or the official standard definition.
>
May 2 '07 #16
On May 2, 10:30 am, Old Wolf <oldw...@inspire.net.nzwrote:
Must have been a long day for Ron and Alf. The parameter to 'b'
has type 'pointer to function taking no arguments and returning B'.
It is the same as:
B b( B (*)() );
Is it ok to ignore the "*" while still have the same meaning?
"type arg" is not a "standard format". Some simple declarations
look like that, but the syntax for declarations is more complicated,
with "arg" sometimes coming in between different parts of "type".
For example, int x[5]
Indeed, :)
Moreover, if this is a definition of "b", then why can I receive a B
object after this execution, where's the invocation of the function "b"?

Huh? (Post some code to illustrate what you mean).
I made the mistake of thinking this init "b" and realised I was
wrong....
I think the default constructor is called in the first case. For the
second case, a default constructor is called for "B()", then a copy-
constructor is called (by the compiler) to copy the "B" to a temporary
result, and then another copy-constructor is called to copy the
temporary B object to "b" to initialize "b", is this right?

You have one step too many (I think). A temporary object is default-
constructed, and then 'b' is copy-constructed from that object.
I see, so the additional temp object is only created if a function is
returning, is it right?

Thanks
Jess

May 2 '07 #17
On May 2, 1:48 pm, Ron Natalie <r...@spamcop.netwrote:
Correct, but the original poster thought he was calling a constructor
which isn't true by either yours or the official standard definition.
I made that mistake because in the constructor initializer, we can do
something similar:

struct A{
int x;
int y;
A():x(1),y(){}
};

I then thought we can create an A object by "A a()". I get it now.
thanks!

Jess

May 2 '07 #18
* Ron Natalie:
Alf P. Steinbach wrote:
>Sort of. You might argue that that statement is purely about
terminology.

And the standard has non-ambiguous terminology.
> But even so, the standard uses the terms "call" and "invoke",

But doesn't refer to programs being able to call constructors. It
specifically states to the contrary.
It specifically uses those terms about source code calls in numerous
places. As far as I know it doesn't state anything to the contrary, and
that's up at the 99.99% confidence level since this has been discussed
numerous times, at length. I suggest you look up the most recent thread
about this in clc++m (James Kanze and me).

I don't see why you insist on continually inserting this non-sequitor
incorrect argument in discussions. It just confuses the issue.
Sorry, that's not even wrong.

>An accurate statement is that outside a constructor initializer list
you can't call a constructor on existing storage, except by using
low-level (not type safe) shenanigans[1].

You can't even do it inside a constructor initializer list (if you're
talking about the mem-init list), the belief that such a list is a
constructor call further confuses the fact that the mem-initializers
have no bearing at all on constructor invocation order.
Sorry, that's incorrect.

>A more useful but not quite as accurate statement is that with at
least one user-defined constructor C++ effectively provides a
construction guarantee where each object (including each sub-object)
receives exactly one constructor call, which happens before anything
else.

That is correct IF you remove the words user-defined.
Sorry that's incorrect. Specifically, without a user-defined constructor,

B b;

locally in a function, does not initialize B (another example is use in
a union).

The reason the statement is not quite as accurate as the previous one is
that even with a user defined constructor you can still do e.g.

B b = b;

where the compiler is permitted to optimize away the copy constructor
call; anyway, no real initialization here, but also no low-level things.

>And the reason has nothing to do with constructor calls, but with an
ambiguity in the grammar, which the standard requires is always
resolved in favor of a function declaration, if possible.

Correct, but the original poster thought he was calling a constructor
which isn't true by either yours or the official standard definition.
Consider the variant with extra parentheses: it's just a syntax issue.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
May 2 '07 #19
Alf P. Steinbach wrote:
>
Sorry that's incorrect. Specifically, without a user-defined constructor,

B b;

locally in a function, does not initialize B (another example is use in
a union).
There is an implicitly defined consturctor (admittedly rarely actually
causing executable code), but it depends on what the definition of B
is. This is actually the who reason the term "value initialized" was
invented.
May 2 '07 #20
* Ron Natalie:
Alf P. Steinbach wrote:
>>
Sorry that's incorrect. Specifically, without a user-defined
constructor,

B b;

locally in a function, does not initialize B (another example is use
in a union).
There is an implicitly defined consturctor (admittedly rarely actually
causing executable code), but it depends on what the definition of B
is.
Right. Sorry about the typos ("B" instead of "b", and unstated
assumption of PODness). The point remains: if B is a POD it will not be
initialized (the standard states in 8/9 that it will have an
"indeterminate initial value", as opposed to being default-initialized).

Not relevant to that point, but I think relevant to those who might read
this: regardless of B's PODness, without a user-defined constructor POD
members won't be initialized here (12.1/7).

To ensure initialization you need a user-defined constructor, even
though as I exemplified earlier that's not an absolute guarantee, only
an effective guarantee for sensible code.

This is actually the who reason the term "value initialized" was
invented.
Nope. The object b above is not value-initialized. It's either not
initialized at all, or if non-POD, the default constructor is called.

Value initialization applies to an expression such as

B();

see 8.5/7, and the intent is that the effect of this expression should
not depend on whether there is a non-POD member or not: that this
expression should always give some initialization of all members,
zeroing all POD stuff.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
May 2 '07 #21
On May 2, 8:19 am, Jess <w...@hotmail.comwrote:
On May 2, 10:30 am, Old Wolf <oldw...@inspire.net.nzwrote:
Must have been a long day for Ron and Alf. The parameter to 'b'
has type 'pointer to function taking no arguments and returning B'.
It is the same as:
B b( B (*)() );

Is it ok to ignore the "*" while still have the same meaning?
"type arg" is not a "standard format". Some simple declarations
look like that, but the syntax for declarations is more complicated,
with "arg" sometimes coming in between different parts of "type".
For example, int x[5]

Indeed, :)
Moreover, if this is a definition of "b", then why can I receive a B
object after this execution, where's the invocation of the function "b"?
Huh? (Post some code to illustrate what you mean).

I made the mistake of thinking this init "b" and realised I was
wrong....
I think the default constructor is called in the first case. For the
second case, a default constructor is called for "B()", then a copy-
constructor is called (by the compiler) to copy the "B" to a temporary
result, and then another copy-constructor is called to copy the
temporary B object to "b" to initialize "b", is this right?
You have one step too many (I think). A temporary object is default-
constructed, and then 'b' is copy-constructed from that object.

I see, so the additional temp object is only created if a function is
returning, is it right?

Thanks
Jess

May 2 '07 #22
On May 2, 8:19 am, Jess <w...@hotmail.comwrote:
On May 2, 10:30 am, Old Wolf <oldw...@inspire.net.nzwrote:
Must have been a long day for Ron and Alf. The parameter to 'b'
has type 'pointer to function taking no arguments and returning B'.
It is the same as:
B b( B (*)() );
Is it ok to ignore the "*" while still have the same meaning?
More the reverse. According to the standard, it's permitted, je
even required, to pretend that the "(*)" is there, even when it
isn't. The type expression "B()" declares a function; if we
wanted to give it a name, we would write "B f()". The standard
says, however, that when we declare a function parameter to have
a type "function", it is treated as a "pointer to function",
much as when we declare an array, it is treated as "pointer".

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'école, France, +33 (0)1 30 23 00 34

May 2 '07 #23
On May 3, 2:24 am, James Kanze <james.ka...@gmail.comwrote:
More the reverse. According to the standard, it's permitted, je
even required, to pretend that the "(*)" is there, even when it
isn't. The type expression "B()" declares a function; if we
wanted to give it a name, we would write "B f()". The standard
says, however, that when we declare a function parameter to have
a type "function", it is treated as a "pointer to function",
much as when we declare an array, it is treated as "pointer".
I see, thanks a lot!

Jess

May 4 '07 #24

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

54
by: Brandon J. Van Every | last post by:
I'm realizing I didn't frame my question well. What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump up in your chair and scream "Wow! Ruby has *that*? That is SO...
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
5
by: radnus2004 | last post by:
Hi all, I am not clear what is the difference between signed and unsigned in C. Many say, unsigned means only +ve values and 0. Can I use unsigned int i = -3? What happens internally ? What...
10
by: tinesan | last post by:
Hello fellow C programmers, I'm just learning to program with C, and I'm wondering what the difference between signed and unsigned char is. To me there seems to be no difference, and the...
35
by: Sunil | last post by:
Hi all, I am using gcc compiler in linux.I compiled a small program int main() { printf("char : %d\n",sizeof(char)); printf("unsigned char : ...
13
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
669
by: Xah Lee | last post by:
in March, i posted a essay 鈥淲hat is Expressiveness in a Computer Language鈥, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
17
by: SemSem | last post by:
i want to know waht is an index and how we use it with a simple example including the main of the program . thanx -- Islam Khalil,
2
by: manishamca | last post by:
can anyone say me how to find the difference of values present in two textbox and display the result in the third textbox. for eg: <input type=text name=t1 value=123> <input...
9
by: viki1967 | last post by:
Hi all! This new forum its great! :) Congratulations !!! My answer: why this my code not working? Nothing error but not work the difference.... : <html>
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.