Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #8194 > unrolled thread
| Started by | Archard Lias <archardlias@googlemail.com> |
|---|---|
| First post | 2011-07-25 05:00 -0700 |
| Last post | 2011-07-25 14:04 -0700 |
| Articles | 10 — 7 participants |
Back to article view | Back to comp.lang.c++
Pipe in the "return" statement Archard Lias <archardlias@googlemail.com> - 2011-07-25 05:00 -0700
Re: Pipe in the "return" statement Ian Collins <ian-news@hotmail.com> - 2011-07-26 00:03 +1200
Re: Pipe in the "return" statement Archard Lias <archardlias@googlemail.com> - 2011-07-25 07:16 -0700
Re: Pipe in the "return" statement Billy Mays <81282ed9a88799d21e77957df2d84bd6514d9af6@myhashismyemail.com> - 2011-07-25 10:31 -0400
Re: Pipe in the "return" statement John Gordon <gordon@panix.com> - 2011-07-25 14:39 +0000
Re: Pipe in the "return" statement Archard Lias <archardlias@googlemail.com> - 2011-07-25 08:06 -0700
Re: Pipe in the "return" statement gwowen <gwowen@gmail.com> - 2011-07-25 07:42 -0700
Re: Pipe in the "return" statement TonyO <guinness.tony@gmail.com> - 2011-07-25 05:52 -0700
Re: Pipe in the "return" statement gwowen <gwowen@gmail.com> - 2011-07-25 06:00 -0700
Re: Pipe in the "return" statement red floyd <redfloyd@gmail.com> - 2011-07-25 14:04 -0700
| From | Archard Lias <archardlias@googlemail.com> |
|---|---|
| Date | 2011-07-25 05:00 -0700 |
| Subject | Pipe in the "return" statement |
| Message-ID | <acaab166-32c1-43df-b1a4-e3b47c62be36@m10g2000yqd.googlegroups.com> |
Hi,
I have come across something I don't really understand and would be
grateful if someone could shed some light into my understanding of it.
In the documentation of the Qt4 libs in the page regarding the
QAbstractTableModel you find, to make the table editable, the
following:
Qt::ItemFlags StringListModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return Qt::ItemIsEnabled;
return QAbstractItemModel::flags(index) | Qt::ItemIsEditable;
}
Now I'm working with PySide, the Python bindings from Nokia and I
figured the
return in the function to be related with a parent
(QAbstractItemModel)
followed by the actual Flag that says: "yes the item, the index is
pointing
at, is actually editable". So translation of the C++ to Python would
be, and
it actually worked:
def flags(self, index):
if not index.isValid():
return Qt.ItemIsEnabled
return super(self.__class__, self).flags(index) |
Qt.ItemIsEditable
Still I dont get how I am supposed to understand the pipe and its task/
idea/influece on control flow, of:
return <statement> | <statement>
??
Thankful if you could help me with this.
Kind regards,
Archard Lias
[toc] | [next] | [standalone]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Date | 2011-07-26 00:03 +1200 |
| Message-ID | <9954ddFkjuU10@mid.individual.net> |
| In reply to | #8194 |
On 07/26/11 12:00 AM, Archard Lias wrote: > Hi, > > Still I dont get how I am supposed to understand the pipe and its task/ > idea/influece on control flow, of: > return<statement> |<statement> > ?? It's simply a bitwise OR. -- Ian Collins
[toc] | [prev] | [next] | [standalone]
| From | Archard Lias <archardlias@googlemail.com> |
|---|---|
| Date | 2011-07-25 07:16 -0700 |
| Message-ID | <1c175da2-79f4-40ed-803f-217dc935df6c@m8g2000yqo.googlegroups.com> |
| In reply to | #8195 |
On Jul 25, 2:03 pm, Ian Collins <ian-n...@hotmail.com> wrote: > On 07/26/11 12:00 AM, Archard Lias wrote: > > > Hi, > > > Still I dont get how I am supposed to understand the pipe and its task/ > > idea/influece on control flow, of: > > return<statement> |<statement> > > ?? > > It's simply a bitwise OR. > > -- > Ian Collins Yes, but how does it get determined, which one actually gets returned?
[toc] | [prev] | [next] | [standalone]
| From | Billy Mays <81282ed9a88799d21e77957df2d84bd6514d9af6@myhashismyemail.com> |
|---|---|
| Date | 2011-07-25 10:31 -0400 |
| Message-ID | <j0juod$193$1@speranza.aioe.org> |
| In reply to | #8206 |
On 07/25/2011 10:16 AM, Archard Lias wrote: > On Jul 25, 2:03 pm, Ian Collins<ian-n...@hotmail.com> wrote: >> On 07/26/11 12:00 AM, Archard Lias wrote: >> >>> Hi, >> >>> Still I dont get how I am supposed to understand the pipe and its task/ >>> idea/influece on control flow, of: >>> return<statement> |<statement> >>> ?? >> >> It's simply a bitwise OR. >> >> -- >> Ian Collins > > Yes, but how does it get determined, which one actually gets returned? The return statement returns a single value from a function context. The pipe operator takes 2 values and bitwise ORs* them together. That result is then returned to the caller. The pipe character in this instance is not the same as in a shell. * This is not exactly true, but don't worry about it. -- Bill
[toc] | [prev] | [next] | [standalone]
| From | John Gordon <gordon@panix.com> |
|---|---|
| Date | 2011-07-25 14:39 +0000 |
| Message-ID | <j0jv6l$phb$1@reader1.panix.com> |
| In reply to | #8206 |
In <1c175da2-79f4-40ed-803f-217dc935df6c@m8g2000yqo.googlegroups.com> Archard Lias <archardlias@googlemail.com> writes:
> > > return <statement> | <statement>
> >
> > It's simply a bitwise OR.
> Yes, but how does it get determined, which one actually gets returned?
Neither value is returned on its own; the bitwise OR of both values is
computed and that value is returned.
It seems that you don't understand what the term "bitwise or" means.
Perhaps a Google search might help.
--
John Gordon A is for Amy, who fell down the stairs
gordon@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
[toc] | [prev] | [next] | [standalone]
| From | Archard Lias <archardlias@googlemail.com> |
|---|---|
| Date | 2011-07-25 08:06 -0700 |
| Message-ID | <5291febc-eae3-4baf-8359-e5ef0ee7d1b4@h17g2000yqn.googlegroups.com> |
| In reply to | #8210 |
On Jul 25, 4:39 pm, John Gordon <gor...@panix.com> wrote: > In <1c175da2-79f4-40ed-803f-217dc935d...@m8g2000yqo.googlegroups.com> Archard Lias <archardl...@googlemail.com> writes: > > > > > return <statement> | <statement> > > > > It's simply a bitwise OR. > > Yes, but how does it get determined, which one actually gets returned? > > Neither value is returned on its own; the bitwise OR of both values is > computed and that value is returned. > > It seems that you don't understand what the term "bitwise or" means. > Perhaps a Google search might help. > > -- > John Gordon A is for Amy, who fell down the stairs > gor...@panix.com B is for Basil, assaulted by bears > -- Edward Gorey, "The Gashlycrumb Tinies" It figures, that you are right :P.
[toc] | [prev] | [next] | [standalone]
| From | gwowen <gwowen@gmail.com> |
|---|---|
| Date | 2011-07-25 07:42 -0700 |
| Message-ID | <382edbf0-eab9-4df3-b912-667a442a9371@en1g2000vbb.googlegroups.com> |
| In reply to | #8206 |
On Jul 25, 3:16 pm, Archard Lias <archardl...@googlemail.com> wrote: > Yes, but how does it get determined, which one actually gets returned? It's a bit-wise or, not a logical or so what get returns is a combination of the two results. The n-th bit of the return value is 1 if the n-th bit of either (or both) of the two statements (Fixed width font) a 1 1 0 0 0 1 1 1 0 0 1 0 1 ... b 0 1 0 1 0 0 1 0 0 0 0 1 1 ... a|b 1 1 0 1 0 1 1 0 0 0 1 1 1 ... (/Fixed width font)
[toc] | [prev] | [next] | [standalone]
| From | TonyO <guinness.tony@gmail.com> |
|---|---|
| Date | 2011-07-25 05:52 -0700 |
| Message-ID | <08098816-0332-4ae2-a125-35418bac0da2@dp9g2000vbb.googlegroups.com> |
| In reply to | #8194 |
> Still I dont get how I am supposed to understand the pipe and its task/
> idea/influece on control flow, of:
> return <statement> | <statement>
In the words of René Magritte,
return <statement> | <statement>
^
Ceci n'est pas une pipe.
[toc] | [prev] | [next] | [standalone]
| From | gwowen <gwowen@gmail.com> |
|---|---|
| Date | 2011-07-25 06:00 -0700 |
| Message-ID | <bd73ae4c-e7e2-4ed2-939f-6e4cd7a8976c@w27g2000yqk.googlegroups.com> |
| In reply to | #8200 |
On Jul 25, 1:52 pm, TonyO <guinness.t...@gmail.com> wrote: >> return <statement> | <statement> > > In the words of René Magritte, > > return <statement> | <statement> > ^ > Ceci n'est pas une pipe. *golf clap*
[toc] | [prev] | [next] | [standalone]
| From | red floyd <redfloyd@gmail.com> |
|---|---|
| Date | 2011-07-25 14:04 -0700 |
| Message-ID | <ab8b6e1f-f850-446b-aa34-47997974825d@d7g2000vbv.googlegroups.com> |
| In reply to | #8200 |
On Jul 25, 5:52 am, TonyO <guinness.t...@gmail.com> wrote: > > Still I dont get how I am supposed to understand the pipe and its task/ > > idea/influece on control flow, of: > > return <statement> | <statement> > > In the words of René Magritte, > > return <statement> | <statement> > ^ > Ceci n'est pas une pipe. We have a WINNER!!!!!!
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.c++
csiph-web