473,500 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

static allocation question...

-- I didn't notice anything about this specifically
-- in the c.l.c. FAQ, nor could i get a strait answere
-- from my copy of the C standard. Hopeing someone
-- here could shed some light on it :)...

6.2.1
"If the declarator or type specifier that declares
the identifier appears inside a block or within the
list of parameter declarations in a function definition,
the identifier has block scope, which terminates at the
end of the associated block."

I believe this talks about what we learned early on :

int main(void)
{
{
int a;
}
printf("%d\n", a); /* ERROR - Invalid */
return 0;
}

Once outside of the closing } a is no longer accessible.
It's out of our current "scope". Which brings me to my
question. Since that data is static, is it automatically
allocated at program start up?

int main(void)
{
int i;
return 0;
}

As "i" would be in this example ? What if there's a conditional
statement there ? As in :

int main(void)
{
int i = 0;
if(!i) {
int a;
}
return 0;
}

If "a" is /NOT/ automatically allocated with "i", what is
the compiler doing to make sure it gets allocated only when,
and if it's ever needed (like if "i" changes before the
"if", or if it waits for input from a user which we'll assume
is unknown untill runtime will "a" still get allocated ?)

Any help is greatly appreciated, just something i started
wondering about :) FMorales...
Nov 13 '05 #1
34 2123
Did you try this?
In C you have to declare all variables first and then start your code.
So you would have to do
int a;
int i;

What you did is allowed in c++. I mean this code:
int main(void)
{
int i = 0;
if(!i) {
int a;
}
return 0;
}
Won't compile.

FMorales wrote: -- I didn't notice anything about this specifically
-- in the c.l.c. FAQ, nor could i get a strait answere
-- from my copy of the C standard. Hopeing someone
-- here could shed some light on it :)...

6.2.1
"If the declarator or type specifier that declares
the identifier appears inside a block or within the
list of parameter declarations in a function definition,
the identifier has block scope, which terminates at the
end of the associated block."

I believe this talks about what we learned early on :

int main(void)
{
{
int a;
}
printf("%d\n", a); /* ERROR - Invalid */
return 0;
}

Once outside of the closing } a is no longer accessible.
It's out of our current "scope". Which brings me to my
question. Since that data is static, is it automatically
allocated at program start up?

int main(void)
{
int i;
return 0;
}

As "i" would be in this example ? What if there's a conditional
statement there ? As in :

int main(void)
{
int i = 0;
if(!i) {
int a;
}
return 0;
}

If "a" is /NOT/ automatically allocated with "i", what is
the compiler doing to make sure it gets allocated only when,
and if it's ever needed (like if "i" changes before the
"if", or if it waits for input from a user which we'll assume
is unknown untill runtime will "a" still get allocated ?)

Any help is greatly appreciated, just something i started
wondering about :) FMorales...


Nov 13 '05 #2
On Sat, 04 Oct 2003 18:09:53 -0500, Pushkar Pradhan wrote:
Did you try this?
In C you have to declare all variables first and then start your code.
only in c89
in c99, variables can be declared anywhere.
So you would have to do
int a;
int i;

What you did is allowed in c++. I mean this code:
> int main(void)
> {
> int i = 0;
> if(!i) {
> int a;
> }
> return 0;
> }


Won't compile.

FMorales wrote:
-- I didn't notice anything about this specifically
-- in the c.l.c. FAQ, nor could i get a strait answere
-- from my copy of the C standard. Hopeing someone
-- here could shed some light on it :)...

6.2.1
"If the declarator or type specifier that declares
the identifier appears inside a block or within the
list of parameter declarations in a function definition,
the identifier has block scope, which terminates at the
end of the associated block."

I believe this talks about what we learned early on :

int main(void)
{
{
int a;
}
printf("%d\n", a); /* ERROR - Invalid */
return 0;
}

Once outside of the closing } a is no longer accessible.
It's out of our current "scope". Which brings me to my
question. Since that data is static, is it automatically
allocated at program start up?

int main(void)
{
int i;
return 0;
}

As "i" would be in this example ? What if there's a conditional
statement there ? As in :

int main(void)
{
int i = 0;
if(!i) {
int a;
}
return 0;
}
any good compiler won't generate code for your conditional statement
unless you set i to be "volatile".

If "a" is /NOT/ automatically allocated with "i", what is
the compiler doing to make sure it gets allocated only when,
and if it's ever needed (like if "i" changes before the
the compiler can't assume that unless you provide the keyword static
"if", or if it waits for input from a user which we'll assume
is unknown untill runtime will "a" still get allocated ?)

Any help is greatly appreciated, just something i started
wondering about :) FMorales...


Nov 13 '05 #3
Pushkar Pradhan wrote:
Did you try this?
In C you have to declare all variables first and then start your code.
So you would have to do
int a;
int i;

What you did is allowed in c++. I mean this code:
> int main(void)
> {
> int i = 0;
> if(!i) {
> int a;
> }
> return 0;
> }

Pushkar, you must have suffered a temporary access of madness. There is
nothing wrong with declaring variables at the beginning of a block. The
code above is perfectly valid C89 (as well as C99, of course).

--
Bertrand Mollinier Toublet
closity = 1.0 / farthitude
-- Arthur J. O'Dwyer

Nov 13 '05 #4
FMorales wrote:
-- I didn't notice anything about this specifically
-- in the c.l.c. FAQ, nor could i get a strait answere
-- from my copy of the C standard. Hopeing someone
-- here could shed some light on it :)...

6.2.1
"If the declarator or type specifier that declares
the identifier appears inside a block or within the
list of parameter declarations in a function definition,
the identifier has block scope, which terminates at the
end of the associated block."

I believe this talks about what we learned early on :

int main(void)
{
{
int a;
}
printf("%d\n", a); /* ERROR - Invalid */
return 0;
}

Once outside of the closing } a is no longer accessible.
It's out of our current "scope". Which brings me to my
Correct.
question. Since that data is static, is it automatically
allocated at program start up?
It's *not* static. It is an *automatic variable*.

int main(void)
{
int i;
return 0;
}

As "i" would be in this example ? What if there's a conditional
statement there ? As in :

int main(void)
{
int i = 0;
if(!i) {
int a;
}
`a' is now out of scope.
return 0;
}

If "a" is /NOT/ automatically allocated with "i", what is
the compiler doing to make sure it gets allocated only when,
and if it's ever needed (like if "i" changes before the
"if", or if it waits for input from a user which we'll assume
is unknown untill runtime will "a" still get allocated ?)
What a particular compiler does is irrelevant; it is free to do
whatever it wants as long as the program semantics are correct.

Any help is greatly appreciated, just something i started
wondering about :) FMorales...

Fair enough.

HTH,
--ag


--
Artie Gold -- Austin, Texas
Oh, for the good old days of regular old SPAM.

Nov 13 '05 #5
There is no need to get nasty, I tried it on my system and then only
sent my post. Somebody already pointed out I was wrong.
No need for you to show your frustration here.
Bertrand Mollinier Toublet wrote:
Pushkar Pradhan wrote:
Did you try this?
In C you have to declare all variables first and then start your code.
So you would have to do
int a;
int i;

What you did is allowed in c++. I mean this code:
> int main(void)
> {
> int i = 0;
> if(!i) {
> int a;
> }
> return 0;
> }

Pushkar, you must have suffered a temporary access of madness. There is
nothing wrong with declaring variables at the beginning of a block. The
code above is perfectly valid C89 (as well as C99, of course).


Nov 13 '05 #6
On Sat, 04 Oct 2003 22:45:29 GMT, "FMorales" <al****@comcast.net>
wrote:
-- I didn't notice anything about this specifically
-- in the c.l.c. FAQ, nor could i get a strait answere
-- from my copy of the C standard. Hopeing someone
-- here could shed some light on it :)...

6.2.1
"If the declarator or type specifier that declares
the identifier appears inside a block or within the
list of parameter declarations in a function definition,
the identifier has block scope, which terminates at the
end of the associated block."

I believe this talks about what we learned early on :

int main(void)
{
{
int a;
}
printf("%d\n", a); /* ERROR - Invalid */
return 0;
}

Once outside of the closing } a is no longer accessible.
It's out of our current "scope". Which brings me to my
question. Since that data is static, is it automatically
allocated at program start up?

int main(void)
{
int i;
return 0;
}

As "i" would be in this example ? What if there's a conditional
statement there ? As in :

int main(void)
{
int i = 0;
if(!i) {
int a;
}
return 0;
}

If "a" is /NOT/ automatically allocated with "i", what is
the compiler doing to make sure it gets allocated only when,
and if it's ever needed (like if "i" changes before the
"if", or if it waits for input from a user which we'll assume
is unknown untill runtime will "a" still get allocated ?)

Any help is greatly appreciated, just something i started
wondering about :) FMorales...

You don't have any static objects in your sample code. While you
rethink the problem, consider that scope and duration (or life span)
have different meanings.
<<Remove the del for email>>
Nov 13 '05 #7
On Sat, 04 Oct 2003 21:23:08 -0500, Pushkar Pradhan wrote:

Bertrand Mollinier Toublet wrote:
Pushkar Pradhan wrote:
Did you try this?
In C you have to declare all variables first and then start your code.
So you would have to do
int a;
int i;

What you did is allowed in c++. I mean this code:
> int main(void)
> {
> int i = 0;
> if(!i) {
> int a;
> }
> return 0;
> }

Pushkar, you must have suffered a temporary access of madness. There is
nothing wrong with declaring variables at the beginning of a block. The
code above is perfectly valid C89 (as well as C99, of course).

There is no need to get nasty, I tried it on my system and then only
sent my post. Somebody already pointed out I was wrong.
No need for you to show your frustration here.


Are you claiming that the compiler you use on your system failed
to compile the code?
Nov 13 '05 #8
Actually I did it without the block {}, that's why it failed. I mean
if(a)
int i;

Sheldon Simms wrote:
On Sat, 04 Oct 2003 21:23:08 -0500, Pushkar Pradhan wrote:
Bertrand Mollinier Toublet wrote:
Pushkar Pradhan wrote:
Did you try this?
In C you have to declare all variables first and then start your code.
So you would have to do
int a;
int i;

What you did is allowed in c++. I mean this code:
> int main(void)
> {
> int i = 0;
> if(!i) {
> int a;
> }
> return 0;
> }
Pushkar, you must have suffered a temporary access of madness. There is
nothing wrong with declaring variables at the beginning of a block. The
code above is perfectly valid C89 (as well as C99, of course).


There is no need to get nasty, I tried it on my system and then only
sent my post. Somebody already pointed out I was wrong.
No need for you to show your frustration here.

Are you claiming that the compiler you use on your system failed
to compile the code?


Nov 13 '05 #9
I think it is allocated at runtime, I used gdb on:
int i = 0;
if(!i) {
int a;
}
return 0;
} When I tried to print a outside the loop gdb said:
No symbol "a" in current context
So it must have been created when the block is reached.

FMorales wrote: -- I didn't notice anything about this specifically
-- in the c.l.c. FAQ, nor could i get a strait answere
-- from my copy of the C standard. Hopeing someone
-- here could shed some light on it :)...

6.2.1
"If the declarator or type specifier that declares
the identifier appears inside a block or within the
list of parameter declarations in a function definition,
the identifier has block scope, which terminates at the
end of the associated block."

I believe this talks about what we learned early on :

int main(void)
{
{
int a;
}
printf("%d\n", a); /* ERROR - Invalid */
return 0;
}

Once outside of the closing } a is no longer accessible.
It's out of our current "scope". Which brings me to my
question. Since that data is static, is it automatically
allocated at program start up?

int main(void)
{
int i;
return 0;
}

As "i" would be in this example ? What if there's a conditional
statement there ? As in :

int main(void)
{
int i = 0;
if(!i) {
int a;
}
return 0;
}

If "a" is /NOT/ automatically allocated with "i", what is
the compiler doing to make sure it gets allocated only when,
and if it's ever needed (like if "i" changes before the
"if", or if it waits for input from a user which we'll assume
is unknown untill runtime will "a" still get allocated ?)

Any help is greatly appreciated, just something i started
wondering about :) FMorales...


Nov 13 '05 #10

"Pushkar Pradhan" <pu*****@gri.msstate.edu> wrote in message
news:3F**************@gri.msstate.edu...
I think it is allocated at runtime, I used gdb on:
> int i = 0;
> if(!i) {
> int a;
> }
> return 0;
> }

When I tried to print a outside the loop gdb said:
No symbol "a" in current context
So it must have been created when the block is reached.


See now that to me makes sense. Since "a" is only valid inside
that block of code, i wouldn't be able to read it outside. My
only question would be this :

Just because "a" is not readable outside that scope, does that
mean "a" hasn't already been allocated ? So would there already
be memory set aside for an integer variable named "a", but
because of the rules in the C language it's simply not accessible,
untill inside that block of code ? OR if there's a situation like the
one i presented where there's a posibility that block of code may
infact never be reached, would allocating "a" be based on if that
condition is true, and i enter the block of code ? (Thus at program
startup there is no space for an integer variable named "a". But
rather when my condition is met, and i enter the block of code
where "a" is valid, THEN and only then does my program
"dynamically" (i use this with caution, as i'm not using any standard
library functions, malloc\calloc\realloc, etc.. but it's created 'on the
fly'. If that proves to be the case) create space for an integer
named "a" for use inside that block of code. Which i assume would
be 'free'ed after that block of code...) Example :

int main(void)
{
int i = 1; /* When my program starts it would have allocated room
* for an integer variable with the name "i"
*/
if(!i) {
int a; /* Now the only place in this code "a" is valid is inside
this
* if statement. However you can clearly see it will infact
* be evaluated to 'false' thus anything inside the block of
* code will never be reached. So would memory for "a" have
* been set aside /anyways/ ? Thus i have 2 places in memory
* allocated for 2 integers, one with the name "i" one with
"a",
* when my program starts up ? OR would there be space for
* only "i" and "if(!i)" ever evaluates true, then and only
then will
* space be allocated for "a". For use only inside this code
block.
*/
}
return 0;
}

Also i apologize for not being more specific, when i used the term
'static', i didn't mean to imply : static int a; , which i seemed to have
done. I mean data that's not dynamically allocated via, malloc\calloc\
realloc, etc... That's the term i've used "statically allocated" as apposed
to "dynamically", but i can see how just static caused confusion.

Again appreciate any comments, and or questions... Thx again all,
FMorales

--<snip>

Nov 13 '05 #11
[Background: we are given code like:

void f(void) {
...
if (some_expression) {
int a;
...
}
...
}

inside a function.]

In article <7lOfb.682843$Ho3.146199@sccrnsc03>
FMorales <al****@comcast.net> writes:
Just because "a" is not readable outside that scope, does that
mean "a" hasn't already been allocated ?


In a conforming C program -- that is, one that obeys the rules of
the C standards, and does not use undefined behavior -- what code
would you write to detect whether or not memory for that object
has been allocated?

If it is impossible to write such code, *any* C compiler is free
to *change* the actual code in any way that you cannot detect. In
other words, wherever there is no way to tell precisely when a
variable is allocated, the compiler is allowed to allocate it (or
not allocate it) at any time.

I will tell you that it *is* impossible to write conforming code
that discovers precisely when "a" is allocated. (You get to decide
whether you believe me. :-) ) Thus, the compiler is free to allocate
space for the variable "a" upon entering function f(), or to defer
allocating space for the variable "a" until entering the block
containing "a". There are, in the general case, valid arguments
for doing it *both* ways, so some compilers choose one way, and
some choose the other.

Any time you write code in C (instead of, e.g., assembly), you give
up some degree of control. If you were writing x86 assembly, *you*
could choose whether to place "a" in a stack frame, and if so, when
to adjust the %esp register -- but if you use a C compiler, you
give up that ability. Your C compiler chooses where to place "a"
and when to allocate any such storage. Unless you are willing to
pin yourself down to one specific version of one specific compiler
(and target machine), under one specific set of optimization flags
and the like, you cannot predict exactly what it will do. But for
ordinary C code, you should not care; and you should not *need* to
care. As long as you obey your part of the "ANSI C contract" --
the restrictions the C standard places on you as a programmer --
you should be able to depend on your compiler obeying its part, of
generating code that does what that standard requires.

Sometimes, of course, you will find that you need something that
Standard C simply does not provide. In this case, you must rely
on some sort of additional guarantees, such as those in an additional
standard (e.g., some POSIX standard) or those from some compiler
vendor. It seems unlikely that you will find many (if any) guarantees
about when a variable like "a" is allocated, though. Luckily, it
is equally unlikley to matter in practice.
--
In-Real-Life: Chris Torek, Wind River Systems (BSD engineering)
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
email: forget about it http://67.40.109.61/torek/index.html (for the moment)
Reading email is like searching for food in the garbage, thanks to spammers.
Nov 13 '05 #12
Pushkar Pradhan <pu*****@gri.msstate.edu> writes:
Did you try this?
In C you have to declare all variables first and then start your code.
So you would have to do
int a;
int i;

What you did is allowed in c++. I mean this code:
> int main(void)
> {
> int i = 0;
> if(!i) {
> int a;
> }
> return 0;
> }


Won't compile.


Really? Did you try?

Compound statements have always allowed declarations (at the
top), even in C90. "int a" is clearly within a compound
statement. No problem.

-Micah
Nov 13 '05 #13
"FMorales" <al****@comcast.net> writes:
6.2.1
"If the declarator or type specifier that declares
the identifier appears inside a block or within the
list of parameter declarations in a function definition,
the identifier has block scope, which terminates at the
end of the associated block."

I believe this talks about what we learned early on :

int main(void)
{
{
int a;
}
printf("%d\n", a); /* ERROR - Invalid */
return 0;
}

Once outside of the closing } a is no longer accessible.
It's out of our current "scope". Which brings me to my
question. Since that data is static, is it automatically
allocated at program start up?
That data is *not* static, it is automatic. How it is allocated
is not really important, but since main could be called
recursively, it would probably be allocated as it is encountered
(actually, any smart compiler wouldn't allocate it at all, seeing
that it's never used before its scope ends).
int main(void)
{
int i;
return 0;
}

As "i" would be in this example ? What if there's a conditional
statement there ? As in :

int main(void)
{
int i = 0;
if(!i) {
int a;
}
return 0;
}

If "a" is /NOT/ automatically allocated with "i", what is
the compiler doing to make sure it gets allocated only when,
and if it's ever needed (like if "i" changes before the
"if", or if it waits for input from a user which we'll assume
is unknown untill runtime will "a" still get allocated ?)


A compiler is perfectly fine to allcoate it along with i or not:
it just won't let you refer to it unless you're within the if
statement block.

-Micah

Nov 13 '05 #14
On 2003-10-05, Chris Torek <no****@elf.eng.bsdi.com> wrote:
[Background: we are given code like:

void f(void) {
...
if (some_expression) {
int a;
...
}
...
}

inside a function.]

In article <7lOfb.682843$Ho3.146199@sccrnsc03>
FMorales <al****@comcast.net> writes:
Just because "a" is not readable outside that scope, does that
mean "a" hasn't already been allocated ?

[...]
I will tell you that it *is* impossible to write conforming code that
discovers precisely when "a" is allocated. (You get to decide whether
you believe me. :-) )
(Since the only requirement of a conforming program is that it be
acceptable by a conforming implementation, it would be unwise to
bet against this.)
Thus, the compiler is free to allocate space for
the variable "a" upon entering function f(), or to defer allocating
space for the variable "a" until entering the block containing "a".
There are, in the general case, valid arguments for doing it *both*
ways, so some compilers choose one way, and some choose the other.


In addition, consider the case when the function includes multiple
blocks with their own automatic variables:

void f(void) {
...
if (some_expression) {
int a;
...
}
...
if (some_other_expression) {
int b;
...
}
...
}

Then "a" and "b" may occupy the same allocated space, irrespective of
when the space is allocated.

-- James
Nov 13 '05 #15
In 'comp.lang.c', "FMorales" <al****@comcast.net> wrote:
6.2.1
"If the declarator or type specifier that declares
the identifier appears inside a block or within the
list of parameter declarations in a function definition,
the identifier has block scope, which terminates at the
end of the associated block."

I believe this talks about what we learned early on :

int main(void)
{
{
int a;
}
printf("%d\n", a); /* ERROR - Invalid */
Yes. The 'a' identifier is not in scope.
return 0;
}

Once outside of the closing } a is no longer accessible.
It's out of our current "scope". Which brings me to my
question. Since that data is static, is it automatically
allocated at program start up?
If you mean 'If a data is defined static', yes, it is somehow 'allocated' at
startup. It's also set to a valid 0 value.
int main(void)
{
int i;
return 0;
}

As "i" would be in this example ?
'i' is not defined 'static'. It's an automatic variable, and it's not
initialized at all.
What if there's a conditional
statement there ? As in : int main(void)
{
int i = 0;
if(!i) {
int a;
}
return 0;
}

If "a" is /NOT/ automatically allocated with "i", what is
the compiler doing to make sure it gets allocated only when,
and if it's ever needed (like if "i" changes before the
"if", or if it waits for input from a user which we'll assume
is unknown untill runtime will "a" still get allocated ?)


The actual detailed way of the data is allocated is irrelevent. All we need
to know is that the scope is limited to the block where it is defined.

This code is invalid:

int main (void)
{
int *p = NULL;
int a = 2;

if (a > 1)
{
int x;
p = &x;
}

*p = 123; /* UB: the value of the pointer is no longer valid. */

return 0;
}

--
-ed- em**********@noos.fr [remove YOURBRA before answering me]
The C-language FAQ: http://www.eskimo.com/~scs/C-faq/top.html
<blank line>
FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/
Nov 13 '05 #16
In 'comp.lang.c', Pushkar Pradhan <pu*****@gri.msstate.edu> wrote:
Did you try this?
Did you?
In C you have to declare all variables first and then start your code.
Wrong. In C90, they must be defined a the top of a bloc. In C99, anywhere.
So you would have to do
int a;
int i;
You can, but you don't /have to/
What you did is allowed in c++. I mean this code:


What the heck is C++?
int main(void)
{
int i = 0;
if(!i) {
int a;
}
return 0;
}


Won't compile.


Wrong. Try it yourself.

main.c: In function `main':
main.c:5: warning: unused variable `a'
Please check your skills before posting. I suggest you re-read the Kernighan
and Ritchie ed.2. It won't hurt.

--
-ed- em**********@noos.fr [remove YOURBRA before answering me]
The C-language FAQ: http://www.eskimo.com/~scs/C-faq/top.html
<blank line>
FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/
Nov 13 '05 #17
In 'comp.lang.c', Paulo Pereira <pa*****************@wanadoo.fr> wrote:
In C you have to declare all variables first and then start your code.


only in c89


Wrong. They have to be defined at the top of a block.

--
-ed- em**********@noos.fr [remove YOURBRA before answering me]
The C-language FAQ: http://www.eskimo.com/~scs/C-faq/top.html
<blank line>
FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/
Nov 13 '05 #18
In 'comp.lang.c', Pushkar Pradhan <pu*****@gri.msstate.edu> wrote:
> int main(void)
> {
> int i = 0;
> if(!i) {
> int a;
> }
> return 0;
> }
<...> I tried it on my system and then only
sent my post.


I'm curious. What was the error message?

--
-ed- em**********@noos.fr [remove YOURBRA before answering me]
The C-language FAQ: http://www.eskimo.com/~scs/C-faq/top.html
<blank line>
FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/
Nov 13 '05 #19
In 'comp.lang.c', Pushkar Pradhan <pu*****@gri.msstate.edu> wrote:
Actually I did it without the block {}, that's why it failed. I mean
if(a)
int i;


Of course, if you changed the code... The C language (C90) says 'at the the
top of a block'.

--
-ed- em**********@noos.fr [remove YOURBRA before answering me]
The C-language FAQ: http://www.eskimo.com/~scs/C-faq/top.html
<blank line>
FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/
Nov 13 '05 #20
Pushkar Pradhan <pu*****@gri.msstate.edu> wrote in message news:<3F**************@gri.msstate.edu>...
Did you try this?
In C you have to declare all variables first and then start your code.
So you would have to do
int a;
int i;

What you did is allowed in c++. I mean this code:
> int main(void)
> {
> int i = 0;
> if(!i) {
> int a;
> }

return 0;
> }


Won't compile.


yes it will (or rather, "why do *you* think it wont?" ).

there isn't anything wrong in that code.

goose,
why dont you try it and see ?
Nov 13 '05 #21
In 'comp.lang.c', "zf***********@defsdfadd.com" <zf***********@defsdfadd.com>
wrote:
From: Emmanuel Delahaye <em**********@noos.fr>


You *must* use a valid from address as per the rules of your news service
provider.
You could lose your account.


1 - Mind your own business
2 - My news provider has my address. I connect via a a login and password.

--
-ed- em**********@noos.fr [remove YOURBRA before answering me]
The C-language FAQ: http://www.eskimo.com/~scs/C-faq/top.html
<blank line>
FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/
Nov 13 '05 #22
"no****@nospam.invalid" <no****@nospam.invalid> writes:
Hello Emmanuel Delahaye,

On 6-Oct-2003, Emmanuel Delahaye <em**********@noos.fr> wrote:
In 'comp.lang.c', "zf***********@defsdfadd.com"
<zf***********@defsdfadd.com>
wrote:
> From: Emmanuel Delahaye <em**********@noos.fr>

You *must* use a valid from address as per the rules of your news
service
provider.
You could lose your account.


1 - Mind your own business
2 - My news provider has my address. I connect via a a login and password.


http://www.news.individual.net/faq.html#5.3


Still not minding your own business. It is clear to anyone
looking at the above what Mr. Delahaye's actual address is. While
it may be a technical violation of their rules, their rules are
absurdly broken: their recommended workaround is to use a free
address and not check it, which has the net effect of not
providing other readers with a means by which to contact him (and
if he goes for the other reccomendations--check it
sporadically--it is unnecessary time wasted reading
spams). Contrary to their assertions, this is a clear violation
of netiquette.

If anyone actually blocks his account over such a triviality, I'd
recommend launching a boycott of their service.

While we're on the subject, perhaps some of us should point out
these obvious flaws to the service?

-Micah
Nov 13 '05 #23
In 'comp.lang.c', "no****@nospam.invalid" <no****@nospam.invalid> wrote:
http://www.news.individual.net/faq.html#5.3


From: "no****@nospam.invalid" <no****@nospam.invalid>

HAHAHAHAHA!

--
-ed- em**********@noos.fr [remove YOURBRA before answering me]
The C-language FAQ: http://www.eskimo.com/~scs/C-faq/top.html
<blank line>
FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/
Nov 13 '05 #24
In 'comp.lang.c', Micah Cowan <mi***@cowan.name> wrote:
Still not minding your own business. It is clear to anyone
looking at the above what Mr. Delahaye's actual address is. While
it may be a technical violation of their rules, their rules are
absurdly broken: their recommended workaround is to use a free
address and not check it, which has the net effect of not
providing other readers with a means by which to contact him (and
if he goes for the other reccomendations--check it
sporadically--it is unnecessary time wasted reading
spams). Contrary to their assertions, this is a clear violation
of netiquette.

If anyone actually blocks his account over such a triviality, I'd
recommend launching a boycott of their service.

While we're on the subject, perhaps some of us should point out
these obvious flaws to the service?


It's kind of you, but:
_____________________
/| /| | |
||__|| | Please do not |
/ O O\__ | feed the |
/ \ | Trolls |
/ \ \|_____________________|
/ _ \ \ ||
/ |\____\ \ ||
/ | | | |\____/ ||
/ \|_|_|/ | _||
/ / \ |____| ||
/ | | | --|
| | | |____ --|
* _ | |_|_|_| | \-/
*-- _--\ _ \ | ||
/ _ \\ | / `
* / \_ /- | | |
* ___ c_c_c_C/ \C_c_c_c____________
--
-ed- em**********@noos.fr [remove YOURBRA before answering me]
The C-language FAQ: http://www.eskimo.com/~scs/C-faq/top.html
<blank line>
FAQ de f.c.l.c : http://www.isty-info.uvsq.fr/~rumeau/fclc/
Nov 13 '05 #25
Emmanuel Delahaye <em**********@noos.fr> wrote:
In 'comp.lang.c', "zf***********@defsdfadd.com" <zf***********@defsdfadd.com>
wrote:
From: Emmanuel Delahaye <em**********@noos.fr>


You *must* use a valid from address as per the rules of your news service
provider.
You could lose your account.


1 - Mind your own business


He's right, though. IIRC you're even in violation of an RFC if you don't
have a valid reply-to. Apart from that, some people, me included, won't
unmunge an address to send e-mail.

Richard
Nov 13 '05 #26
Richard Bos <rl*@hoekstra-uitgeverij.nl> scribbled the following:
He's right, though. IIRC you're even in violation of an RFC if you don't
have a valid reply-to. Apart from that, some people, me included, won't
unmunge an address to send e-mail.


Why won't you? Because you don't have the time? Because you don't know
how? Because you have to uphold a code of honour and to unmunge
addresses would be a disgrace?

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ---------------------------\
| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste W++ B OP+ |
\----------------------------------------- Finland rules! ------------/
"How can we possibly use sex to get what we want? Sex IS what we want."
- Dr. Frasier Crane
Nov 13 '05 #27
Joona I Palaste <pa*****@cc.helsinki.fi> wrote:
Richard Bos <rl*@hoekstra-uitgeverij.nl> scribbled the following:
He's right, though. IIRC you're even in violation of an RFC if you don't
have a valid reply-to. Apart from that, some people, me included, won't
unmunge an address to send e-mail.


Why won't you? Because you don't have the time? Because you don't know
how? Because you have to uphold a code of honour and to unmunge
addresses would be a disgrace?


Because if people won't be decent netizens, keep to the RFCs and refrain
from munging their addresses (and by munging, add to the load on the
central DNS servers, and thereby to all the rest of us), I don't see why
I should make any extra effort for their sakes.

Richard
Nov 13 '05 #28
Richard Bos <rl*@hoekstra-uitgeverij.nl> scribbled the following:
Joona I Palaste <pa*****@cc.helsinki.fi> wrote:
Richard Bos <rl*@hoekstra-uitgeverij.nl> scribbled the following:
> He's right, though. IIRC you're even in violation of an RFC if you don't
> have a valid reply-to. Apart from that, some people, me included, won't
> unmunge an address to send e-mail.
Why won't you? Because you don't have the time? Because you don't know
how? Because you have to uphold a code of honour and to unmunge
addresses would be a disgrace?

Because if people won't be decent netizens, keep to the RFCs and refrain
from munging their addresses (and by munging, add to the load on the
central DNS servers, and thereby to all the rest of us), I don't see why
I should make any extra effort for their sakes.


Is that really *an extra EFFORT* or do you just pretend that it's one,
because by principle you stick by RFCs?

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ---------------------------\
| Kingpriest of "The Flying Lemon Tree" G++ FR FW+ M- #108 D+ ADA N+++|
| http://www.helsinki.fi/~palaste W++ B OP+ |
\----------------------------------------- Finland rules! ------------/
"And according to Occam's Toothbrush, we only need to optimise the most frequent
instructions."
- Teemu Kerola
Nov 13 '05 #29
On 6 Oct 2003 20:57:43 GMT, in comp.lang.c you wrote:
In 'comp.lang.c', "no****@nospam.invalid" <no****@nospam.invalid> wrote:
http://www.news.individual.net/faq.html#5.3


From: "no****@nospam.invalid" <no****@nospam.invalid>

HAHAHAHAHA!


There is no need to laugh. He is using a service which
allows him to be antonymous. So he can use any address he
wants.
You CAN'T!

Although I have no objections whatsoever in your using just
about any address you fancy 8-)

Nov 13 '05 #30
On Tue, 07 Oct 2003 07:46:03 GMT, in comp.lang.c ,
rl*@hoekstra-uitgeverij.nl (Richard Bos) wrote:
Emmanuel Delahaye <em**********@noos.fr> wrote:
In 'comp.lang.c', "zf***********@defsdfadd.com" <zf***********@defsdfadd.com>
wrote:
>> From: Emmanuel Delahaye <em**********@noos.fr>
>
> You *must* use a valid from address as per the rules of your news service
> provider.
> You could lose your account.
1 - Mind your own business


He's right, though. IIRC you're even in violation of an RFC if you don't
have a valid reply-to.


I have to say that I regard that particular RFC as out of date. In
this day of address harvesting bots, putting a valid email in your
usenet postings is about as sensible as leaving the front door open
and going to work.

I'm strongly of the opinion that we make life hard for spammers in
the first place, and not everyone can afford spamcop or mailwasher etc
to deal with the consequences.
Plus my ISP has enough trouble dealing with legit mail, without
expecting them to handle a zillion spams too... :-)
Apart from that, some people, me included, won't
unmunge an address to send e-mail.
Fair enough. Mine's not munged, but all spam DOES get reported, as do
all attempted FW penetrations. No prisoners taken here...
Richard


--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
Nov 13 '05 #31
> int main(void)
{
{
int a;
}
printf("%d\n", a); /* ERROR - Invalid */
return 0;
}

"a" doesn't have static but automatic storage class here ince it is a local
variable.
Locals are pushed on the stack when the function where they're declared gets
invoked
and are destroyed when the function returns.

void foo
{
{ int a; }
{ int b; }
}

IMHO the compiler might choose here wheather to assign a and b the same
memory location or not since you cannot use a or b together. thats similar
to declaring a union.

void foo(int a)
{
if (a)
{
int b;
}
}

The compiler might choose here wheather to allocate b at function entry or
at the
time when the block where b is declared in is entered.

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
Nov 13 '05 #32
"cody" <do*********************@gmx.de> wrote:

<SNIP>
Locals are pushed on the stack when the function where they're declared gets
invoked
and are destroyed when the function returns.
There is no requirement imposed by the standard for an implementation to
provide a stack.

void foo
{
{ int a; }
{ int b; }
}

IMHO the compiler might choose here wheather to assign a and b the same
memory location or not since you cannot use a or b together. thats similar
to declaring a union.


Ahrrchrrchrrrarrrrgh-gh... WHAT? Exchanging eyeballs with tomatoes is
similar to wearing a pair of glasses?

I have to <SNIP> now...

Irrwahn
--
If you don't care where you are, then you ain't lost.
Nov 13 '05 #33
> There is no requirement imposed by the standard for an implementation to
provide a stack.


where should local variables be stored then? if not a stack then it must be
something similar to a stack.
void foo
{
{ int a; }
{ int b; }
}

IMHO the compiler might choose here wheather to assign a and b the same
memory location or not since you cannot use a or b together. thats similarto declaring a union.


Ahrrchrrchrrrarrrrgh-gh... WHAT? Exchanging eyeballs with tomatoes is
similar to wearing a pair of glasses?


i stupid comparison i know but both have the fact that more than one
variable is using the same memory location.

--
cody

[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
Nov 13 '05 #34
"cody" <do*********************@gmx.de> wrote:

Irrwahn wrote:
There is no requirement imposed by the standard for an implementation to
provide a stack.


where should local variables be stored then? if not a stack then it must be
something similar to a stack.


The implementation is free to store automatic variables wherever it
seems suitable, as long as it does not violate any requirements imposed
by the standard (use or even presence of a stack is not among these).

<SNIP>

Regards
--
Irrwahn
(ir*******@freenet.de)
Nov 13 '05 #35

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

Similar topics

11
8936
by: sks_cpp | last post by:
When do static members allocate memory? (at load time) How about static variables within a method? Where is the memory for static variables - is it allocated on the heap or does it have a...
6
3254
by: J Anderson | last post by:
Greetings, I was going through the quake2 source code (as you do) when I noticed arrays are statically allocated on the stack instead of being allocated dynamically. I’ve seen this before and...
24
2719
by: Steven T. Hatton | last post by:
In the following code, at what point is S::c fully defined? #include <iostream> using std::cout; using std::endl; using std::ostream; class C { int _v;
11
912
by: Jonan | last post by:
Hello, For several reasons I want to replace the built-in memory management with some custom built. The mem management itlsef is not subject to my question - it's ok to the point that I have...
11
3025
by: toton | last post by:
Hi, I have little confusion about static memory allocation & dynamic allocation for a cluss member. I have class like class Bar{ public: explicit Bar(){ cout<<"bar default"<<endl; }
24
19032
by: Ken | last post by:
In C programming, I want to know in what situations we should use static memory allocation instead of dynamic memory allocation. My understanding is that static memory allocation like using array...
7
8203
by: Jo | last post by:
Hi, How can i differentiate between static and dynamic allocated objects? For example: void SomeFunction1() { CObject *objectp = new CObject; CObject object;
53
26321
by: fdmfdmfdm | last post by:
This is an interview question and I gave out my answer here, could you please check for me? Q. What are the memory allocation for static variable in a function, an automatic variable and global...
6
3535
by: Marvin Barley | last post by:
I have a class that throws exceptions in new initializer, and a static array of objects of this type. When something is wrong in initialization, CGI program crashes miserably. Debugging shows...
10
4378
by: swornavidhya.mahadevan | last post by:
Which allocation (Static / Dynamic) is suitable for the situation when we are trying to allocate for a overloaded memory when the memory is full and no space to allocate. What will happen if both...
0
7134
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7180
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7395
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5485
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4921
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3103
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.