f



why have both "." and "->" ?

I used to remember why c++ needed both ?
Could somebody help me here ?

For example

class A{
 f();
};

 A* aa;

You could do either "aa->f()" or "(*aa).f()".  So why does C++ need both operators.

Raj
0
rajkumar (47)
6/23/2004 3:48:27 PM
comp.lang.c++ 49423 articles. 7 followers. Post Follow

23 Replies
1696 Views

Similar Articles

[PageSpeed] 20

"raj" <rajkumar@hotmail.com> schreef in bericht
news:d7fee6d0.0406230748.694b966b@posting.google.com...
> I used to remember why c++ needed both ?
> Could somebody help me here ?
>
> For example
>
> class A{
>  f();
> };
>
>  A* aa;
>
> You could do either "aa->f()" or "(*aa).f()".  So why does C++ need both
operators.
>
> Raj

There is a difference I believe that xxxx->yyyy is used if xxxx is a pointer
to an object/class and xxxx.yyyyy if xxxx is the object/classs


0
6/23/2004 3:52:06 PM
> class A{
>  f();
> };
> 
>  A* aa;
> 
> You could do either "aa->f()" or "(*aa).f()".  So why does C++ need both operators.
IMHO it's simply convenience.

Bye,  Marco

0
marco59 (1)
6/23/2004 3:57:21 PM
raj wrote:
>
> You could do either "aa->f()" or "(*aa).f()".  So why does C++ need both
> operators.

The second form involves more typing and requires more effort to read.

-- 
Russell Hanneken
eunaarxra@cbobk.pbz
Use ROT13 to decode my email address.


0
me4 (19624)
6/23/2004 4:00:54 PM
In message <WOhCc.15115$Wr.8451@newsread1.news.pas.earthlink.net>, 
Russell Hanneken <me@privacy.net> writes
>raj wrote:
>>
>> You could do either "aa->f()" or "(*aa).f()".  So why does C++ need both
>> operators.
>
>The second form involves more typing and requires more effort to read.
>
And they might have different effects if aa is of user-defined type.
Usually, operator->() returns (something that behaves like) a pointer; 
operator*() returns a reference. Either or both might be some kind of 
proxy object, not the object that aa ultimately "points" at. There's no 
guarantee that they indirect to the same thing, or even that they are 
both defined.

-- 
Richard Herring
0
Richard
6/23/2004 4:53:50 PM
raj wrote:

> I used to remember why c++ needed both ?
> Could somebody help me here ?
> 
> For example
> 
> class A{
>  f();
> };
> 
>  A* aa;
> 
> You could do either "aa->f()" or "(*aa).f()".  So why does C++ need both operators.
> 
> Raj

The reason is obvious: for compatibility with C.

-- 
Pull out a splinter to reply.
0
gershwin2 (30)
6/23/2004 5:07:47 PM
raj wrote:

> You could do either "aa->f()" or "(*aa).f()".  So why does C++ need both operators.


The short answer to your question is, "because C did it that way." C++
was not about to redefine the usage. So why did C?

For the case above, the reply is obvious, syntactic sugar. The better
question is, why didn't C overload the . operator to work on either
struct/union objects or on pointers? For that, you'd have to ask Dennis
Ritchie. There probably is a good reason.



Brian Rodenborn
0
first.last3 (701)
6/23/2004 5:19:08 PM
"raj" <rajkumar@hotmail.com> wrote in message
news:d7fee6d0.0406230748.694b966b@posting.google.com...
> I used to remember why c++ needed both ?
> Could somebody help me here ?
>
> For example
>
> class A{
>  f();
> };
>
>  A* aa;
>
> You could do either "aa->f()" or "(*aa).f()".  So why does C++ need both
operators.

The -> operator is not technically necessary, it's just
a 'shorthand' notation for (*).

Use whichever you like, but keep in mind that ->
is typically considered more 'idomatic' (i.e.
most coders will recognize it, and often makes
reading code faster.)

-Mike


0
mkwahler (3821)
6/23/2004 5:21:38 PM
"raj" <rajkumar@hotmail.com> wrote in message
news:d7fee6d0.0406230748.694b966b@posting.google.com...
> I used to remember why c++ needed both ?
> Could somebody help me here ?
>
> For example
>
> class A{
>  f();
> };
>
>  A* aa;
>
> You could do either "aa->f()" or "(*aa).f()".  So why does C++ need both
operators.

The second is pretty awkward, but anyway, what would you do with this?
A aa;


0
nobody (5159)
6/23/2004 5:35:00 PM
"jeffc" <nobody@nowhere.com> wrote in message
news:40d9c102_3@news1.prserv.net...
>
> The second is pretty awkward, but anyway, what would you do with this?
> A aa;

Never mind, didn't read your question quite right.  You are not implying
that we don't need ".".


0
nobody (5159)
6/23/2004 5:36:55 PM
On 23 Jun 2004 08:48:27 -0700, rajkumar@hotmail.com (raj) wrote:

>I used to remember why c++ needed both ?
>Could somebody help me here ?
>
>For example
>
>class A{
> f();
>};
>
> A* aa;
>
>You could do either "aa->f()" or "(*aa).f()".  So why does C++ need both operators.

You can separately overload operator-> and unary operator* for user
defined types. That's the only difference really, but aa->f() is much
nicer to read.

Tom
-- 
C++ FAQ: http://www.parashift.com/c++-faq-lite/
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
0
tom_usenet3 (1118)
6/23/2004 5:39:24 PM
raj wrote:
> ...
> I used to remember why c++ needed both ?
> Could somebody help me here ?
> 
> For example
> 
> class A{
>  f();
> };
> 
>  A* aa;
> 
> You could do either "aa->f()" or "(*aa).f()".  So why does C++ need both operators.
> ...

Well, any boolean function can be implemented by using logical operation
'xor' (or 'nor', or 'nand') and nothing else. Yet instead of single
'xor' we have 'and' (&&), 'or' (||) and 'not' (!) in the language. Why?
The make code easier to read. The same applies to '->' operator. In many
situations it produces more compact and easily readable code.

And it also gives us an additional overloadable operator.

-- 
Best regards,
Andrey Tarasevich

0
6/23/2004 6:24:23 PM
Richard Herring posted:

> In message <WOhCc.15115$Wr.8451@newsread1.news.pas.earthlink.net>, 
> Russell Hanneken <me@privacy.net> writes
>>raj wrote:
>>>
>>> You could do either "aa->f()" or "(*aa).f()".  So why does C++ need
>>> both operators. 
>>
>>The second form involves more typing and requires more effort to read.
>>
> And they might have different effects if aa is of user-defined type.
> Usually, operator->() returns (something that behaves like) a pointer; 
> operator*() returns a reference. Either or both might be some kind of 
> proxy object, not the object that aa ultimately "points" at. There's no
> guarantee that they indirect to the same thing, or even that they are 
> both defined.
> 


Sounds like bullshit.

-JKop
0
null25 (1555)
6/23/2004 6:27:08 PM
JKop wrote:
> Richard Herring posted:
> 
> 
>>In message <WOhCc.15115$Wr.8451@newsread1.news.pas.earthlink.net>, 
>>Russell Hanneken <me@privacy.net> writes
>>
>>>raj wrote:
>>>
>>>>You could do either "aa->f()" or "(*aa).f()".  So why does C++ need
>>>>both operators. 
>>>
>>>The second form involves more typing and requires more effort to read.
>>>
>>
>>And they might have different effects if aa is of user-defined type.
>>Usually, operator->() returns (something that behaves like) a pointer; 
>>operator*() returns a reference. Either or both might be some kind of 
>>proxy object, not the object that aa ultimately "points" at. There's no
>>guarantee that they indirect to the same thing, or even that they are 
>>both defined.
>>
> 
> 
> 
> Sounds like bullshit.
> 
> -JKop

Look up "smart pointers" on google.  Then tell us it's bullshit.
0
no.spam9 (2339)
6/23/2004 6:46:17 PM
On Wed, 23 Jun 2004 11:27:08 -0700, JKop wrote:

> Richard Herring posted:
> 
>> In message <WOhCc.15115$Wr.8451@newsread1.news.pas.earthlink.net>,
>> Russell Hanneken <me@privacy.net> writes
>>>raj wrote:
>>>>
>>>> You could do either "aa->f()" or "(*aa).f()".  So why does C++ need
>>>> both operators.
>>>
>>>The second form involves more typing and requires more effort to read.
>>>
>> And they might have different effects if aa is of user-defined type.
>> Usually, operator->() returns (something that behaves like) a pointer;
>> operator*() returns a reference. Either or both might be some kind of
>> proxy object, not the object that aa ultimately "points" at. There's no
>> guarantee that they indirect to the same thing, or even that they are
>> both defined.
>> 
>> 
>> 
> Sounds like bullshit.
> 
> -JKop

But it is not:

struct Type0
{
    int foo() const
    {
        return 42;
    }
};

struct Type1
{
    int foo() const
    {
        return 7;
    }
};

struct Proxy
{
    Type0 type0_;
    Type1 type1_;

    Type0 & operator* ()
    {
        return type0_;
    }
    
    Type1 * operator-> ()
    {
        return &type1_;
    }
};

#include <iostream>

int main()
{
    Proxy p;
    std::cout << (*p).foo() << '\n';
    std::cout << p->foo() << '\n';
}
0
acehreli (217)
6/23/2004 6:50:31 PM
Ali Cehreli posted:

> struct Type0
> {
>     int foo() const
>     {
>         return 42;
>     }
> };
> 
> struct Type1
> {
>     int foo() const
>     {
>         return 7;
>     }
> };
> 
> struct Proxy
> {
>     Type0 type0_;
>     Type1 type1_;
> 
>     Type0 & operator* ()
>     {
>         return type0_;
>     }
>     
>     Type1 * operator-> ()
>     {
>         return &type1_;
>     }
> };
> 
> #include <iostream>
> 
> int main()
> {
>     Proxy p;
>     std::cout << (*p).foo() << '\n';
>     std::cout << p->foo() << '\n';
> }


I stand corrected.

-JKop
0
null25 (1555)
6/23/2004 6:54:48 PM
Default User wrote:
> raj wrote:
> 
> 
>>You could do either "aa->f()" or "(*aa).f()".  So why does C++ need both operators.
> 
> 
> 
> The short answer to your question is, "because C did it that way." C++
> was not about to redefine the usage. So why did C?
> 
> For the case above, the reply is obvious, syntactic sugar. The better
> question is, why didn't C overload the . operator to work on either
> struct/union objects or on pointers? For that, you'd have to ask Dennis
> Ritchie. There probably is a good reason.

C++ allows overloading of -> but not .

V
0
v.Abazarov (13256)
6/23/2004 8:02:19 PM
Victor Bazarov posted:

> Default User wrote:
>> raj wrote:
>> 
>> 
>>>You could do either "aa->f()" or "(*aa).f()".  So why does C++ need
>>>both operators. 
>> 
>> 
>> 
>> The short answer to your question is, "because C did it that way." C++
>> was not about to redefine the usage. So why did C?
>> 
>> For the case above, the reply is obvious, syntactic sugar. The better
>> question is, why didn't C overload the . operator to work on either
>> struct/union objects or on pointers? For that, you'd have to ask
>> Dennis Ritchie. There probably is a good reason.
> 
> C++ allows overloading of -> but not .
> 

He refering to how one can overload * .

If one overloads both * and -> for a class, and makes them different, then 
the following is no longer equal:

SomeClass jk;

jk->Chocolate();

(*jk).Chocolate();


-JKop
0
null25 (1555)
6/23/2004 8:25:59 PM
Victor Bazarov wrote in
news:ellCc.1510$ri.120257@dfw-read.news.verio.net in comp.lang.c++: 

> Default User wrote:
>> raj wrote:
>> 
>> 
>>>You could do either "aa->f()" or "(*aa).f()".  So why does C++ need
>>>both operators. 
>> 
>> 
>> 
>> The short answer to your question is, "because C did it that way."
>> C++ was not about to redefine the usage. So why did C?
>> 
>> For the case above, the reply is obvious, syntactic sugar. The better
>> question is, why didn't C overload the . operator to work on either
>> struct/union objects or on pointers? For that, you'd have to ask
>> Dennis Ritchie. There probably is a good reason.
> 
> C++ allows overloading of -> but not .
> 

I'm guessing that Default Users's point was, that given:

struct X
{
  int x;
};

struct X xx, *xp = &x;

'C' could have done this:

Have xp.x be an int * pointing to xx.x and then *xp.x would have 
derefrenced it (i.e. today's xp->x), no need for (*xp).x or xp->x.

I've encontered one C compiler that actually did this, no idea
wether it was a feature or a bug :).

Rob.
-- 
http://www.victim-prime.dsl.pipex.com/
0
rtw1 (575)
6/23/2004 8:26:50 PM
Victor Bazarov wrote:
> 
> Default User wrote:
> > raj wrote:
> >
> >
> >>You could do either "aa->f()" or "(*aa).f()".  So why does C++ need both operators.
> >
> >
> >
> > The short answer to your question is, "because C did it that way." C++
> > was not about to redefine the usage. So why did C?
> >
> > For the case above, the reply is obvious, syntactic sugar. The better
> > question is, why didn't C overload the . operator to work on either
> > struct/union objects or on pointers? For that, you'd have to ask Dennis
> > Ritchie. There probably is a good reason.
> 
> C++ allows overloading of -> but not .


But if there was no -> operator, then there would probably be a way to
overload the . operator. 

I think that's a result of having two operators, not a cause. As in the
developer(s) didn't think to themselves, "It'd be greate to get rid of
that unnecessary -> but let's keep it so we don't have to allow
overloading the . operator."

The reason there's two is that C did it that way. As a consequence, C++
could take advantage by allowing overloads for one but not the other.



Brian Rodenborn
0
first.last3 (701)
6/23/2004 8:47:02 PM
"Kapt. Boogschutter" <someone@nobody.com> wrote in message
news:cbc91c$jel$1@news5.tilbu1.nb.home.nl...
> "raj" <rajkumar@hotmail.com> schreef in bericht
> news:d7fee6d0.0406230748.694b966b@posting.google.com...
> > I used to remember why c++ needed both ?
> > Could somebody help me here ?
> >
> > For example
> >
> > class A{
> >  f();
> > };
> >
> >  A* aa;
> >
> > You could do either "aa->f()" or "(*aa).f()".  So why does C++ need both
> operators.
> >
> > Raj
>
> There is a difference I believe that xxxx->yyyy is used if xxxx is a
pointer
> to an object/class and xxxx.yyyyy if xxxx is the object/classs
>

That's true, but look at the question again.  The poster explicitly used
(*aa).f(), and that's using a de-referenced pointer, which is the same thing
as your xxxx.yyyy example.

His question was why the "aa->f()" form is needed if you can accomplish it
using "(*aa).f()".

I would guess it's a convenience.  It's sure easier to type, in my opinion!

-Howard


>


0
alicebt (1862)
6/23/2004 9:02:37 PM
raj wrote:

> I used to remember why c++ needed both ?
> Could somebody help me here ?
> 
> For example
> 
> class A{
>  f();
> };
> 
>  A* aa;
> 
> You could do either "aa->f()" or "(*aa).f()".  So why does C++ need both
> operators.
> 
> Raj

After reviewing some of the replies to your question, you may be asking "Why
are people in this news group so obnoxious, condescending, and rude?". I
certainly am asking, but I can't answer that question.

-- 
STH 
Hatton's Law: "There is only One inviolable Law"
KDevelop: http://www.kdevelop.org  SuSE: http://www.suse.com
Mozilla: http://www.mozilla.org
0
susudata (551)
6/24/2004 2:59:58 AM
Mike Wahler wrote:

> "raj" <rajkumar@hotmail.com> wrote in message
> news:d7fee6d0.0406230748.694b966b@posting.google.com...
>> I used to remember why c++ needed both ?
>> Could somebody help me here ?
>>
>> For example
>>
>> class A{
>>  f();
>> };
>>
>>  A* aa;
>>
>> You could do either "aa->f()" or "(*aa).f()".  So why does C++ need both
> operators.
> 
> The -> operator is not technically necessary, it's just
> a 'shorthand' notation for (*).
> 
> Use whichever you like, but keep in mind that ->
> is typically considered more 'idomatic' (i.e.
> most coders will recognize it, and often makes
> reading code faster.)
> 
> -Mike

Now that's an answer worth providing.
-- 
STH 
Hatton's Law: "There is only One inviolable Law"
KDevelop: http://www.kdevelop.org  SuSE: http://www.suse.com
Mozilla: http://www.mozilla.org
0
susudata (551)
6/24/2004 3:03:07 AM
"Ali Cehreli" <acehreli@yahoo.com> wrote in message
news:pan.2004.06.23.11.50.30.198434.3147@yahoo.com...
> On Wed, 23 Jun 2004 11:27:08 -0700, JKop wrote:
>
> > Richard Herring posted:
> >
> >> In message <WOhCc.15115$Wr.8451@newsread1.news.pas.earthlink.net>,
> >> Russell Hanneken <me@privacy.net> writes
> >>>raj wrote:
> >>>>
> >>>> You could do either "aa->f()" or "(*aa).f()".  So why does C++ need
> >>>> both operators.
> >>>
> >>>The second form involves more typing and requires more effort to read.
> >>>
> >> And they might have different effects if aa is of user-defined type.
> >> Usually, operator->() returns (something that behaves like) a pointer;
> >> operator*() returns a reference. Either or both might be some kind of
> >> proxy object, not the object that aa ultimately "points" at. There's no
> >> guarantee that they indirect to the same thing, or even that they are
> >> both defined.
> >>
> >>
> >>
> > Sounds like bullshit.
> >
> > -JKop
>
> But it is not:
>
> struct Type0
> {
>     int foo() const
>     {
>         return 42;
>     }
> };
>
> struct Type1
> {
>     int foo() const
>     {
>         return 7;
>     }
> };
>
> struct Proxy
> {
>     Type0 type0_;
>     Type1 type1_;
>
>     Type0 & operator* ()
>     {
>         return type0_;
>     }
>
>     Type1 * operator-> ()
>     {
>         return &type1_;
>     }
> };
>
> #include <iostream>
>
> int main()
> {
>     Proxy p;
>     std::cout << (*p).foo() << '\n';
>     std::cout << p->foo() << '\n';
> }

Thats not the same behavior the original poster was asking about.  Of course
if you overload the operators to do different things they will behave
differently.


0
agoff7 (4)
6/24/2004 4:13:10 AM
Reply:

Similar Artilces:

why "::", not "."
Why does the method of modules use a dot, and the constants a double colon? e.g. Math::PI and Math.cos -- Posted via http://www.ruby-forum.com/. On Oct 26, 2010, at 01:48 , Oleg Igor wrote: > Why does the method of modules use a dot, and the constants a double > colon? > e.g. > Math::PI and Math.cos For the same reason why inner-classes/modules use double colon, because = they're constants and that's how you look up via constant namespace. Math::PI and ActiveRecord::Base are the same type of lookup... it is = just that Base is a module and PI is a float....

about "++" and "--"
why this program snippet display "8,7,7,8,-7,-8" the program is: main() { int i=8; printf("%d\n%d\n%d\n%d\n%d\n%d\n",++i,--i,i++,i--,-i++,-i--); } > why this program snippet display "8,7,7,8,-7,-8" Ask your compiler-vendor because this result is IMHO implementation-defined. Check this out: http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.15 http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.16 Regards, Irina Marudina fxc123@gmail.com wrote: > why this program snippet display "8,7,7,8,-7,-8&q...

"out" and "in out"
Hi i found the following explaination: In Ada, "in" parameters are similar to C++ const parameters. They are effectively read-only within the scope of the called subprogram. Ada "in out" parameters have a reliable initial value (that passed in from the calling subprogram) and may be modified within the scope of the called procedure. Ada "out" parameters have no reliable initial value, but are expected to be assigned a value within the called procedure. What does "have no reliable initial value" mean when considering the "out" parameter? By c...

Urgent need """""""""""INFORMATICA DEVELOPER"""""""""""""
Hello Partners, How are you ? Please find the requirements below. Title: Database/ETL Developer Duration: 6 months Location: NY Exp: 7+ Locals preferred Database/ETL requirements (Mandatory) Candidate must have worked with financial instruments, preferably Mutual Funds but, Equities are also ok. PL/SQL - packages, Stored procs, Functions, Aggregate functions, Pipelined Functions Informatica 8.6 - especially complex mappings, complex maplets, complex workflows, transformations Oracle 10g/11g Unix/Linux shell scripting Database/ETL requirements (Optional) Data warehousing experience Threading and job concepts in 10g/11g Cost based Optimizer concepts in 10g/11g Must : Experience with XML files and partitioning concepts in Oracle, Collections, Material Views Note : No phone calls please. : send Resumes to karthik@bhaninfo.com Thanks & Regards Karthik BhanInfo karthik@bhaninfo.com ...

["a", "b", "c", "d"] to "a, b, c, d"?
I want to process each element of an array, but the last element should be handled special. Here is an example: def p_ary(ary) str = "" ary.each do |elem| str << elem << ", " end str.chomp!(", ") str end so p_ary(["a", "f", "x", "test"]) produces "a, f, x, test". The code works, but isn't there an easier and more general way for this behaviour? martinus On Tue, 06 Apr 2004 04:23:22 -0700, Martin wrote: > I want to process each element of an array, but the last ele...

"In" "Out" and "Trash"
I just bought a new computer and I re-installed Eudora Light on my new computer. But when I open Eudora, the "In", "Out" and "Trash" links are not on the left side of the screen the way they were on my old computer. How can I get these links back on the left side of the screen? Thank you. On 25 Mar 2007 09:49:22 -0700, "abx" <abfunex@yahoo.com> wrote: >I just bought a new computer and I re-installed Eudora Light on my new >computer. But when I open Eudora, the "In", "Out" and "Trash" links >are ...

what does "->" and "=>" do?
I have read through php.net manuals and have not see any mention about what these operands actually do. I have seen them used in a bunch of different code lately and don't really understand. Example 1: // Legacy Function: Renders the Footer of the Theme function themefooter() { global $engine, $index, $themepath; if ($index != 3) { $engine->do_themefooter($index); } } Example 2: // get the color scheme $colors = pnModAPIFunc('Xanthia','user','getSkinColors', array('skinid' => $skinID, 'paletteid' => $paletteid)); If anyo...

Urgent JAVA Requirement in """"""NEW YORK"""""""""
Hello Partners, How are you ? Please find the requirement below. Location : NY Duration : 8 mnths Rate :Open Job description: Java/J2EE Web Service Developer =B7 (4+ years of application development experience in Java/J2EE and Web service technologies. =B7 Experience with spring & Hibernate. =B7 Experience with J2EE Application Server (preferably Web logic). =B7 Preferable Aqua logic DSP Experience =B7 Preferable Sonic ESB Composite Service experience Experience working in UNIX environment. Good working knowledge of Oracle RDBMS and PL/SQL) Note : Please send your updated resume along with contact no to Karthik@bhaninfo.com. Thanks & Regards Karthik BhanInfo karthik@bhaninfo.com # 1572, 7 th Floor Suites, 1 Blue Hill Plaza Pearl River,NY-10965 www.bhaninfo.com ...

Gary Sokolich """"""
"""""""""" http://www.manta.com/c/mmlq5dm/w-gary-sokolich W Gary Sokolich 801 Kings Road Newport Beach, CA 92663-5715 (949) 650-5379 http://www.tbpe.state.tx.us/da/da022808.htm TEXAS BOARD OF PROFESSIONAL ENGINEERS February 28, 2008 Board Meeting Disciplinary Actions W. Gary Sokolich , Newport Beach, California �V File B-29812 - It was alleged that Dr. Sokolich unlawfully offered or attempted to practice engineering in Texas (...) Dr. Sokolich chose to end the proceedings by signing a Consent Order that was accepted by ...

puts "\\".gsub("\\", "\\\\")
Hello, I have a mini-ruby quiz. Guess what this line of code writes to the console, then try it for yourself: puts "\\".gsub("\\", "\\\\") Why is that so? Martin From: martinus [mailto:martin.ankerl@gmail.com]=20 # Hello, I have a mini-ruby quiz. Guess what this line of code writes to # the console, then try it for yourself: # puts "\\".gsub("\\", "\\\\") puts "\\".gsub("\\", "\\\\") \ #=3D> nil # Why is that so? faq. escaping the escape in sub/gsub. search the archives. maybe you want somethin...

Question about "sprintf" "@" "do for"
Hello, this works: A1=3D1 A2=3D2 A3=3D3 i=3D1 vari=3Dsprintf("A%.f",i) print vari,"=3D",@vari i=3Di+1 vari=3Dsprintf("A%.f",i) print vari,"=3D",@vari i=3Di+1 vari=3Dsprintf("A%.f",i) print vari,"=3D",@vari do for [i=3D1:3]{ vari=3Dsprintf("A%.f",i) print vari } But I want to have "print vari,"=3D",@vari" in the loop. But it dosen't=20 work. Why can't I use "print vari,"=3D",@vari" in the loop? Is there a=20 solution for? J=C3=B6rg Jörg ...

What does this mean ==> ?", ",""
If I run ?", ","" in the immediate window, I get a comma followed by 13 spaces. It is difficult for me to understand this. MLH wrote: > If I run ?", ","" > in the immediate window, > I get a comma followed by 13 spaces. > It is difficult for me to understand this. Have you made sure the HELP file is working? Have you ever actually opened it? commas put data in the debug window into columns. Some people learn by experimentation... some don't. I guess you fit into the latter category. Try this ?"a";"b" You'll get ab Try this ?"a","b" You'll get a b The semi-colon (;) separator means put the results straight after each other the comma (,) separator means put a tab between them (only of course it's not a tab it's x number of spaces. A colon (:) is a line separator in the debug window as well as in code so ?"a";"b":debug.Print "c";"d" returns ab cd And ?"a","b":debug.Print "c","d" returns a b c d and you can do stuff like x = "a": debug.Print x Which returns a To return to your post ?", ","" Means print a literal comma (",") and then a tab (,) and then an empty string (""). -- Terry Kreft "MLH" <CRCI@NorthState.net> wrote in message news:n4f192d189pbiu6mfu2dc...

Re: "out" and "in out"
"no reliable initial value" means, you cannot rely on the value, but it may have a value. This depends on the parameter passing mechanism, which is _not_ related to the parameter mode (contrary to what many people think). So the parameter mode is there (nearly) solely for the information of the reader. The parameter passing mechanism for all kinds of parameters is defined in the RM. There are parameters passed by copy (in and out), by reference; for some it is explicitly left undefined. In your case, the passing mechanism is by reference, so you get what you get. But don't rely...

how to change "/" to "\"
iam new to shell scripting and i have plz can anyone help in changing the pattrern "/" to "\" using the sed command. olympie@gmail.com wrote: > iam new to shell scripting and i have plz can anyone help in changing > the pattrern "/" to "\" using the sed command. sed 's/\//\\/g' will replace all '/' with '\' srp -- http://saju.net.in Saju Pillai <saju.pillai@gmail.com> wrote: >> iam new to shell scripting and i have plz can anyone help in changing >> the pattrern "/" to "\" using ...

"A" is not equal "A"?
I was trying to convert String Array to String A through cycle and than compare the result with String B but eventhough results were the same it returned false. I'am working in BlueJ 3.1.0 Code is: public boolean Method () { String[] Example = {"a","b","c"}; String A = ""; String B = "abc" for (int i = 0; i<3 ; i++) { A = A + Example[i]; } if (A == B) { return true; } } never got true... I appreciate any suggestions how to solve this Den 08.04.2014 10:06, skrev 245dav@gmail.com:...

"==" is NOT TRUE "==", WHY?
[CODE START] x=5; y=8; if (x + y + 1E-15 == 13) a = 3 else a = 8 end [CODE END] When x + y + 1E-15, the code above returns a = 8. When x + y + 1E-16, the code above returns a = 3. Why? Kindly advise. Thanks. "onemilimeter Chen" <onemm@example.com> wrote in message <g7adrj$5tr$1@fred.mathworks.com>... > [CODE START] > x=5; > y=8; > if (x + y + 1E-15 == 13) > a = 3 > else > a = 8 > end > [CODE END] > > When x + y + 1E-15, the code above returns a = 8. > When x + y + 1E-16, the code above returns a = 3. > > Why? ...

what does the "+" and the "-" mean?
I recently read what the "+" and the "-" signs mean for compact discs. Of course, a friend has just asked me and I now forget. I've searched all over the place with no results. Anyone know? TIA! .. -------------------------------------- Mike Richter, were you born with "Scam Artist" emblazoned on your face? -------------------------------------- roscoe james wrote: > > I recently read what the "+" and the "-" signs mean for compact discs. Of > course, a friend h...

Input Mask:>C;; ValidationRule=In("T","F"," ") AutoTab:Yes ;-(
1)Access2003, beating my head against the wall, every other iteration is "can't find macro Upshift" followed by carefully verifying that no blank properties have been entered. Making NO changes at all, sometimes the message goes away, sometimes not. Any clues? 2)The other headbeating iterations are due to no joy when trying to allow T,F,Blank in a 1-character field, with AutoTab enabled. InputMask:>C;; DefaultValue: ValidationRule:In("T","F"," ") everybody says "Works for me!", but it doesn't work for ME: Upshift works, T works, F works, but space does not; I get my ValidationMessage (identical to the rule). I've checked the field in my table: FieldSize:1 Format: InputMask:>C;; Caption: DefaultValue: ValidationRule:In("T","F"," ") Required:No AllowZeroLength:Yes any ideas please? <keithtracypierce@comcast.net> schreef in bericht = news:1155754193.513459.113690@75g2000cwc.googlegroups.com... > 1)Access2003, beating my head against the wall, every other iteration > is "can't find macro Upshift" followed by carefully verifying that no > blank properties have been entered. Making NO changes at all, > sometimes the message goes away, sometimes not. Any clues? >=20 > 2)The other headbeating iterations are due to no joy when trying to > allow T,F,Blank in a 1-character field, with AutoTab enabled. >=20 > InputMask:>C;; > D...

Is there any """Anti Stringizing operator #"""
Hi everybody:D I've a string that contains the name of a class. Some members told that I can use """Stringizing Operator (#)""", but the problem is here, that I have the string, & I want something vice- versa. As we know with """Stringizing Operator (#)""", we can get the stirng name of a class or ... str <--- #ClassA But I want to instantiate a class that I have just it's name as a string. ClassA * clsA = new ??? <--- Str ??? How can I do it? I don't want to use """HardCoding"&qu...

"plot", "imshow" and "quiver"
Hi all. So recently I made the discovery that when use "imshow" command, the YDir parameter under Axis Properties is set to "reverse" by default. To me this seems counter intuitive. Why wouldn't YDir be "normal" by default? When set at "normal" it turns out that my image is actually flipped upside down. On the contrary, when use "quiver" command to plot a vector field, the YDir is set at "normal" by default. Even though this makes more sense to me, because "reversed" YDir is the correct way to display an image (as in "imshow"), the result of "quiver" is that the vector fields this time depict the objects as if they are upside down... So every time I use "quiver" I always add the following line to revert the objects back to its normal orientation... set(gca, 'YDir', 'reverse')... In addition, "plot" uses "normal" setting for YDir. The only issue I have is that I use these commands fairly frequently in my job and sometimes they can get a little bit confusing in terms of display. So I wonder why MATLAB hasn't standardized them so that the objects always get displayed the same way. It's just a comment I have. Thank you. "Clare " <flyingclare@gmail.com> wrote in message news:hefvdk$3md$1@fred.mathworks.com... > Hi all. So recently I made the discovery that when use "imshow" command, > the ...

What does "Standard C", "K&R C" , "ANSI C" mean?
I am just wondering what the following terms usually mean: 1) "Standard C" 2) "K&R C" 3) "ANSI C" I am pretty sure "ANSI C" usually refers to the C89 standard, but what about the other two? What is the "saying" for C99 standard? Thank you On 17 Jan 2005 21:26:42 -0800, "Luke Wu" <LookSkywalker@gmail.com> wrote in comp.lang.c: > I am just wondering what the following terms usually mean: > > 1) "Standard C" The current version of the C language standard. This is now known as "ISO/IEC 9899:19...

how make /%([0-f]{2})/ -> sprintf( "%c", "\x" "\\1" ) problem : var = "\x27" # work var = 27 ; var = "\x" var ; # doesnt work, for sprintf %c
.... On 27.10.2014 18:32, {xmb} wrote: > ... > What a stupid question! Read http://www.catb.org/esr/faqs/smart-questions.html and Learn or Leave thank you _not_ for your useless text. if u want to help do so, u didnt. On Tue, 28 Oct 2014 07:42:00 -0700, {xmb} wrote: > thank you _not_ for your useless text. if u want to help do so, u didnt. Your question was unintelligible. The people in this group are very willing to help, in my experience. Your question just did not show the proper attitude or mental state to justify spending time answering. ...

What is the function similar to ">>" of C and "Input" of Basic
Part of my data file looks like the paragraph below. I need to first find "s", and then read the number (998) after it. Then find "vals", and start reading the following 998 data. I have done this both in Visual C++ and Basic using ">>" and "Input" separately. What's the corresponding function for MATLAB? "fscanf" ignores the blankspace delimiator and puts the whole string together. Thank you in advance. Baodong 1 d 1 u 0 s 998 m 0 c 2 9.99000E-01 1.00000E+00 e 0 t 0 vals 2.68310E-09 0.0680 8.45751E-...

dolby "B", "C"
I've got some old cassettes with unique and original recordings that I'de like to move onto computer. They were recorded with Dolby B. Some were recorded with dolby C. I'de like to transfer the tapes to computer and then "decode" the dolby on the wav files after. My understanding is that since dolby is an analog system, it should be simple to emulate it. I already have a feeling that an expander and a low pass filter (whose strength would follow the loudness contour of the audio) might be the way to go. Any thoughts? Just curious, why do you want to do it this w...

Web resources about - why have both "." and "->" ? - comp.lang.c++

Resources last updated: 3/22/2016 6:11:39 PM