keyongtech


  keyongtech > c > 05/2008

 #16  
05-05-08, 04:52 PM
arnuld
> On Sat, 03 May 2008 16:21:35 +0530, santosh wrote:


> More practically Sunsite could terminate his account with them if they
> were to be alerted to his behaviour. Their rules clearly say that users
> are only to use their own email addresses which actually exist and can
> be delivered to, in the Sender field.



I have mailed them and have asked them to change their policy.
 #17  
05-05-08, 05:08 PM
arnuld
> On Mon, 05 May 2008 04:48:11 +0000, Richard Heathfield wrote:

> Nobody wants to be spammed. On the other hand, how would you like it if
> someone used *your* real address in *their* From field?


:(


> All you have to do is invent an address that is in the correct form but
> guaranteed not to exist. For example, spamlid is a well-formed
> email address that definitely doesn't exist (because there is no top-level
> domain called "invalid"). This is not an area where originality is
> terribly important. If in doubt, use spamlid for From and
> Reply-To, and mung your real email address in your sig block.



how about my present address ? It doe not use any real domain name and is
different enough from common words like spam, invalid, nospam etc.

BTW, I don't see Reply-To header for my own posts, not even for the posts
of BartC and santosh but I do see Reply-To header of yours. ( I have
already enabled all headers in PAN preferences)
 #18  
05-05-08, 05:17 PM
Keith Thompson
arnuld <sunrise> writes:
>> On Mon, 05 May 2008 02:25:53 -0400, CBFalconer wrote:
>> No. People can create new domains and addresses at any time. The
>> .invalid domain is guaranteed not to exist, and thus to never cause
>> problems.

>
> so "invalid" is the only one that is usable :(


<OT>
No, it's not the only one, but it's the most appropriate for your
purposes. Point your web browser to <http://example.com/> and follow
the link for more information.

But even if it were the only one, why would that be a problem? How
many invalid TLDs do you need? (Hint: the correct answer is an
integer between 0 and 2.)

If you want to discuss this further, please find a newsgroup or other
forum where it's topical.
</OT>
 #19  
05-06-08, 02:42 AM
arnuld
> On Mon, 05 May 2008 02:25:53 -0400, CBFalconer wrote:

> No. People can create new domains and addresses at any time. The
> .invalid domain is guaranteed not to exist, and thus to never cause
> problems.



so "invalid" is the only one that is usable :(
 #20  
05-06-08, 02:37 PM
Nick Keighley
On 2 May, 14:44, Richard Heathfield <r...@see.sig.invalid> wrote:
> arnuld said:


[..]
> Well done. You just filled arr_p with a bunch of pointers to i. Why
> bother with the malloc call, then? You could save yourself
> (ARRSIZE-1) * sizeof(int) bytes of memory leak by removing the malloc > call completely.
>>

> pp has the value &arr_p[0], so **pp attempts to find the int value at
> *arr_p[0]. Since arr_p[0] points to i, we're looking for the value of > i.
> That value is indeterminate, because the object i never had a value
> assigned to it.


not even in the for loop?


> Thus, the behaviour is undefined. This loop could execute
> forever (the most likely possibility) or not at all (probably the
> second most likely) or something completely weird could happen.
>
> >     {
> >       printf("**pp = %d\n", **pp);


if you want to print a pointer (and **pp *isn't a pointer)
use %p. Instead of trying to be clever why not use a for loop?

for (i = 0; i < ARRSIZE; i++)
printf ("%p ", (void*)arr_p[i]);

printf ("\n");
[..]
 #21  
05-06-08, 02:44 PM
Richard Heathfield
Nick Keighley said:

> On 2 May, 14:44, Richard Heathfield <r...@see.sig.invalid> wrote:


<snip>

>> Since arr_p[0] points to i, we're looking for the value of >
>> i. That value is indeterminate, because the object i never had a value
>> assigned to it.

>
> not even in the for loop?


Oops - good spot - apologies to OP.
 #22  
05-06-08, 02:57 PM
Nick Keighley
On 2 May, 15:05, arnuld <NoS> wrote:
> > On Fri, 02 May 2008 13:44:50 +0000, Richard Heathfield wrote:


> >>   for( i = 0; i < ARRSIZE - 1; ++i )
> >>     {
> >>       mp = malloc( sizeof( int ) );


> > You don't check to see whether this fails to allocate the requested
> > memory...

>
> done
>
> >>       mp = &i;

> > ...which doesn't really matter, since you throw it away here.

>
> well, then how can I generate a new variable every-time I enter into
> the loop ?


you can't. Well you can but you don't want to.

for( i = 0; i < ARRSIZE - 1; ++i )
{
int new;
arr_p[i] = &new;
}

The Standard doesn't say if new has the same address every time,
but on almost any reasonable implementation it does. Hence you
don't want to do this.

So why not malloc an object and store its address in the array?
You probably meant to do that but your code really didn't
do that.

for( i = 0; i < ARRSIZE - 1; ++i )
{
if ((mp = malloc (sizeof (int))) == NULL)
{
fprintf (stderr, "memory error\n");
abort();
}

arr_p[i] = mp;
}


<snip>
 #23  
05-06-08, 03:04 PM
Nick Keighley
On 6 May, 14:44, Richard Heathfield <r...@see.sig.invalid> wrote:
> Nick Keighley said:
>
> > On 2 May, 14:44, Richard Heathfield <r...@see.sig.invalid> wrote:

>
> <snip>
>
> >> Since arr_p[0] points to i, we're looking for the value of >
> >> i. That value is indeterminate, because the object i never had a value
> >> assigned to it.

>
> > not even in the for loop?

>
> Oops - good spot - apologies to OP.


some languages make it UB to acces the for loop variable
outside the loop (I think- Pascal, Alogol-60 and Ada)
but I think it is guaranteed to point one past the end
of the array after exiting from a "normal" for-loop.
(I can't be arsed to define the exit value in Standarese).
 #24  
05-06-08, 08:55 PM
Keith Thompson
Nick Keighley <nick_keighley_nospam> writes:
[...]
> some languages make it UB to acces the for loop variable
> outside the loop (I think- Pascal, Alogol-60 and Ada)
> but I think it is guaranteed to point one past the end
> of the array after exiting from a "normal" for-loop.
> (I can't be arsed to define the exit value in Standarese).


There's nothing magical about a C90-style for loop. A variable that
happens to be used in one or more of the for loop header's expressions
has whatever value it has after the loop terminates. This:

int i;
for (i = 0; i < 100; i ++) {
/* code that doesn't modify i */
}
printf("i = %d\n", i);

will print "i = 100".

C99 introduces the ability to define a variable in the loop header:

for (int i = 0; i < 100; i ++) { ... }

Referring to such a variable outside the loop isn't merely undefined
bhaevior, it's impossible. (Well, you could save its address in a
pointer variable; dereferencing the pointer outside the loop would
invoke undefined behavior.)

For comparison ...

<OT>
In Pascal, a for loop specifies a range. I *think* the value is
unspecified after the loop terminates, but I don't remember -- and it
probably varies among various implementations and pseudo-standards. I
don't know about Algol-60. Ada's for loop is much more restrictive
than C's:
for I in 0 .. 99 loop
...
end loop;
``I'' is treated as a constant (a non-modifiable object) within the
body of the loop, and doesn't exist outside the loop. You could take
its address and try to refer to it from outside the loop, as you can
in C, but Ada discourages that kind of thing; if you do it anyway, you
get Ada's equivalent of undefined behavior.
</OT>
 #25  
05-07-08, 12:23 AM
CBFalconer
Nick Keighley wrote:
>

.... snip ...
>
> some languages make it UB to acces the for loop variable
> outside the loop (I think- Pascal, Alogol-60 and Ada)
> but I think it is guaranteed to point one past the end
> of the array after exiting from a "normal" for-loop.
> (I can't be arsed to define the exit value in Standarese).


If you define it within the for statement you get the Pascal
effect. E.g. try: "for (int i = 0; i < max; i++) ...;". i
disappears on exit.
 #26  
05-19-08, 04:59 AM
David Thompson
On Mon, 05 May 2008 02:25:53 -0400, CBFalconer <cbfalconer>
wrote:

> arnuld wrote:


> > how about [ <sunrise> ]? It doe not use any real domain
> > name and is different enough from common words like spam, invalid,
> > nospam etc.

>
> No. People can create new domains and addresses at any time. The
> .invalid domain is guaranteed not to exist, and thus to never cause
> problems.


With profuse apologies to Kilmer, only ICANN can make a TLD.
And except for 2char ccTLDs which defer to ISO 3162 MA,
their process is quite public and slow enough you can get plenty of
warning of a possible conflict. But .invalid is indeed guaranteed.

- formerly david.thompson1 || achar(64) || worldnet.att.net

Similar Threads
"WMP has lost it". or "general pointers gratefully accepted"

I'm lost. WMP has me lost. This system has me lost. I wanted to feedback or get fixes, but it seems one has to spend hours here to just find anything. I used older WMPs for a...

"parameter values not valid" printing in Outlook

I am trying to print email messages from OUtlook and I started getting a message that says, "Could not complete this operation. On or more parameter vales are not valid." ...

Finally, a release candidate of the "Pointers" document (introduction to pointers)

Not yet perfect, but: [..] [..] To access the table of contents, use the "Bookmarks" tab in Adobe Acrobat. Comments, corrections, praise, nits, etc., are still welcome!

Finally, a release candidate of the "Pointers" document (introduction to pointers)

Not yet perfect, but: [..] [..] To access the table of contents, use the "Bookmarks" tab in Adobe Acrobat. Comments, corrections, praise, nits, etc., are still welcome!

"expandable" arrays - using pointers ... How to ?

Hi, I want to create a container structure (array/list etc), that is expandable. Currently, I have static arrays like this SomeStruct *ptrArray[MAX_NUM_STRUCT] ; What I...


All times are GMT. The time now is 10:00 AM. | Privacy Policy