[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.c

Re: ---3

John Bode

3/21/2011 7:52:00 PM

On Saturday, March 19, 2011 1:29:43 PM UTC-5, Michael Press wrote:
> In article <ln1v23g...@nuthaus.mib.org>,
> Keith Thompson <ks...@mib.org> wrote:
>
> > Michael Press <rub...@pacbell.net> writes:
> > > int main(void)
> > > {
> > > ---3;
> > > return 0;
> > > }
> > >
> > > error: invalid lvalue in decrement
> > >
> > > ???
> > > Why does this have to be an error?
> > > The value could be -4 or -3 or -2.
> > > If somebody [shuffles feet] wants
> > > to use this construction, then who
> > > would stop him?
> >
> > Apart from the fact that "---3;" is a constraint violation, and
> > that every conforming compiler must issue a diagnostic for it, and
> > in practice I suspect that every existing compiler will reject it:
> >
> > Whatever you intended "---3" to mean, there is certainly a
> > clearer way to express that meaning. For the most nearly sensible
> > interpretation, just write either "-3 - 1" or "-4". Or, since
> > you're discarding the result, just delete that line of code.
>
> First, I am brain dead for writing ---3,
> and acting as if 3 can be decremented.
>
> Second, it can be parsed as (-(-(-(3)))),
> but is not.
>

Don't confuse tokenizing with parsing. The source code must be converted into tokens before it can be parsed, and per the "maximal munch" rule, the code will always be tokenized as "-- -3". "---" will always be tokenized as "-- -".

> Third
>
> int main(void)
> {
> int x = 3;
>
> ---x;
>
> return 0;
> }
>
> gets the same error.
> In function 'main':
> error: invalid lvalue in decrement
>

That's because the result of -x is not an lvalue, and the operand of -- must be an lvalue.

> A warning is well deserved.
> ---x can be parsed into
> something meaningful in C.
>

"---x" will be *tokenized* into "-- -x", which is *parsed* as "--(-x)", which is invalid as described above.
9 Answers

Barry Briggs

3/22/2011 9:34:00 AM

0

John Bode wrote: [snip]

My Usenet client fails to thread your posts correctly.
They seem to be missing the "References" header.

Did GG break this recently?

Regards.

Keith Thompson

3/22/2011 2:36:00 PM

0

Noob <root@127.0.0.1> writes:
> John Bode wrote: [snip]
>
> My Usenet client fails to thread your posts correctly.
> They seem to be missing the "References" header.
>
> Did GG break this recently?

Yes (GG being Google Groups)..

--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.ne...
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"

Sherm Pendley

3/22/2011 5:18:00 PM

0

Noob <root@127.0.0.1> writes:

> John Bode wrote: [snip]
>
> My Usenet client fails to thread your posts correctly.
> They seem to be missing the "References" header.
>
> Did GG break this recently?

Yes - they did. Quite recently in fact, I think it was in the past week
or two. :-(

sherm--

--
Sherm Pendley
<http://camelbones.sourcefor...
Cocoa Developer

William Ahern

3/22/2011 6:01:00 PM

0

Sherm Pendley <sherm.pendley@gmail.com> wrote:
> Noob <root@127.0.0.1> writes:

> > John Bode wrote: [snip]
> >
> > My Usenet client fails to thread your posts correctly.
> > They seem to be missing the "References" header.
> >
> > Did GG break this recently?

> Yes - they did. Quite recently in fact, I think it was in the past week
> or two. :-(

I'm curious if anyone would be interested in a free, text-only newsgroup
service. But not just any free service, stained by abusers and trolls. To
ensure good faith a postcard system would be used. Users would fill out a
request on a postcard and mail it in. Perhaps also the answer to a problem
based on a trapdoor function which would take some non-nominal amount of CPU
time.

Spiros Bousbouras

3/22/2011 7:39:00 PM

0

On Tue, 22 Mar 2011 13:17:56 -0400
Sherm Pendley <sherm.pendley@gmail.com> wrote:
> Noob <root@127.0.0.1> writes:
>
> > John Bode wrote: [snip]
> >
> > My Usenet client fails to thread your posts correctly.
> > They seem to be missing the "References" header.
> >
> > Did GG break this recently?
>
> Yes - they did. Quite recently in fact, I think it was in the past week
> or two. :-(

It's older than that. See for example
<8185959a-9a59-40ba-a6fc-dded25338cb7@glegroupsg2000goo.googlegroups.com>
http://groups.google.com/group/comp.lang.c/msg/4a87f4f5d3832b3f?dm...

Sherm Pendley

3/22/2011 7:42:00 PM

0

William Ahern <william@wilbur.25thandClement.com> writes:

> I'm curious if anyone would be interested in a free, text-only newsgroup
> service.

I was - that's why I'm using one. :-)

sherm--

--
Sherm Pendley
<http://camelbones.sourcefor...
Cocoa Developer

Sherm Pendley

3/22/2011 7:45:00 PM

0

Spiros Bousbouras <spibou@gmail.com> writes:

> On Tue, 22 Mar 2011 13:17:56 -0400
> Sherm Pendley <sherm.pendley@gmail.com> wrote:
>> Noob <root@127.0.0.1> writes:
>>
>> > John Bode wrote: [snip]
>> >
>> > My Usenet client fails to thread your posts correctly.
>> > They seem to be missing the "References" header.
>> >
>> > Did GG break this recently?
>>
>> Yes - they did. Quite recently in fact, I think it was in the past week
>> or two. :-(
>
> It's older than that.

Sort of; It was in beta for quite a long time, but IIRC it "graduated"
to non-beta status quite recently.

sherm--

--
Sherm Pendley
<http://camelbones.sourcefor...
Cocoa Developer

Spiros Bousbouras

3/22/2011 8:09:00 PM

0

On Tue, 22 Mar 2011 15:45:20 -0400
Sherm Pendley <sherm.pendley@gmail.com> wrote:
> Spiros Bousbouras <spibou@gmail.com> writes:
>
> > On Tue, 22 Mar 2011 13:17:56 -0400
> > Sherm Pendley <sherm.pendley@gmail.com> wrote:
> >> Noob <root@127.0.0.1> writes:
> >>
> >> > John Bode wrote: [snip]
> >> >
> >> > My Usenet client fails to thread your posts correctly.
> >> > They seem to be missing the "References" header.
> >> >
> >> > Did GG break this recently?
> >>
> >> Yes - they did. Quite recently in fact, I think it was in the past week
> >> or two. :-(
> >
> > It's older than that.
>
> Sort of; It was in beta for quite a long time, but IIRC it "graduated"
> to non-beta status quite recently.

To paraphrase a well known saying

Google software doesn't get released - it escapes,
leaving a trail of destruction behind it.

Phil Carmody

3/23/2011 10:41:00 PM

0

Spiros Bousbouras <spibou@gmail.com> writes:
> On Tue, 22 Mar 2011 15:45:20 -0400
> Sherm Pendley <sherm.pendley@gmail.com> wrote:
> > Spiros Bousbouras <spibou@gmail.com> writes:
> >
> > > On Tue, 22 Mar 2011 13:17:56 -0400
> > > Sherm Pendley <sherm.pendley@gmail.com> wrote:
> > >> Noob <root@127.0.0.1> writes:
> > >>
> > >> > John Bode wrote: [snip]
> > >> >
> > >> > My Usenet client fails to thread your posts correctly.
> > >> > They seem to be missing the "References" header.
> > >> >
> > >> > Did GG break this recently?
> > >>
> > >> Yes - they did. Quite recently in fact, I think it was in the past week
> > >> or two. :-(
> > >
> > > It's older than that.
> >
> > Sort of; It was in beta for quite a long time, but IIRC it "graduated"
> > to non-beta status quite recently.
>
> To paraphrase a well known saying
>
> Google software doesn't get released - it escapes,
> leaving a trail of destruction behind it.

What now makes me laugh about google is that, despite the fact that
I've clearly said "google groups sucks" on usenet about 100 times (as
a google groups search for that phrase will prove, as it will find
almost none of them, that's how much it sucks), google recruiting
drones mindlessly approach me because I post the occasional patch to
LKML. If they are too stupid to know that I slag them off with a loud
clear voice they are certainly too dumb a company for me to work for.

And that's even true now Nokia has decided to whore its arsehole out
to Microsoft and drop all future Linux (and Symbian) development, and
google are stepping in to pick up the early escapers in Finland.

Now, if I were to receive a letter that began "Dear Mr. Carmody,
please help us fix the total balls-up we've made of google groups"
then I might be more interested.

Phil
--
I find the easiest thing to do is to k/f myself and just troll away
-- David Melville on r.a.s.f1