Monday, April 27, 2009

comp.lang.c++ - 10 new messages in 7 topics - digest

comp.lang.c++
http://groups.google.com/group/comp.lang.c++?hl=en

comp.lang.c++@googlegroups.com

Today's topics:

* An kind of member function name scope specification - 3 messages, 3 authors
http://groups.google.com/group/comp.lang.c++/t/9b9867f3ebb493ad?hl=en
* Replace pointer to member functions? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/164c1840e18e0e8a?hl=en
* U++ 1096 - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/31d71e8485eda075?hl=en
* Simple question - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/9bba34aee870db10?hl=en
* Supplies polo lacoste t-shirt lowest price ship to worldwide - 2 messages, 1
author
http://groups.google.com/group/comp.lang.c++/t/2d5c46c2306a211a?hl=en
* Cheaper True Religion Men's Jeans - discount - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/1cc4800956202f9b?hl=en
* 。◕‿◕。 www.fjrjtrade.com china cheap wholesale nike shoes,air jordan shoes,
air force one shoes. - 1 messages, 1 author
http://groups.google.com/group/comp.lang.c++/t/bc2b97a9aae722ba?hl=en

==============================================================================
TOPIC: An kind of member function name scope specification
http://groups.google.com/group/comp.lang.c++/t/9b9867f3ebb493ad?hl=en
==============================================================================

== 1 of 3 ==
Date: Sun, Apr 26 2009 5:17 pm
From: Ian Collins


Stefan Ram wrote:
> Ian Collins <ian-news@hotmail.com> writes:
>> In that case, call it something like calculateBalance.
>
> I deem that to be ugly. I still follow the advice Rob Pike
> gave 20 years ago:
>
> »Procedure names should reflect what they do;
> function names should reflect what they return.«
>
In the context of C++, what is a function and what is a procedure?

--
Ian Collins


== 2 of 3 ==
Date: Sun, Apr 26 2009 5:36 pm
From: blargg.ei3@gishpuppy.com (blargg)


Ian Collins wrote:
> Stefan Ram wrote:
> > Ian Collins <ian-news@hotmail.com> writes:
> >> In that case, call it something like calculateBalance.
> >
> > I deem that to be ugly. I still follow the advice Rob Pike
> > gave 20 years ago:
> >
> > »Procedure names should reflect what they do;
> > function names should reflect what they return.«
> >
> In the context of C++, what is a function and what is a procedure?

A procedure primarily does something whose side-effects persist after it
returns. A function primarily gives the caller the value of something, and
doesn't usually have any side-effects beyond determining the return value.


== 3 of 3 ==
Date: Sun, Apr 26 2009 5:39 pm
From: ram@zedat.fu-berlin.de (Stefan Ram)


Ian Collins <ian-news@hotmail.com> writes:
>>»Procedure names should reflect what they do;
>>function names should reflect what they return.«
>In the context of C++, what is a function and what is a procedure?

Rob Pike wrote this in the context of C, where it might be
asked as well.

I assume that the terms stem from the Pascal culture.

A Pascal procedure corresponds to a function not returning a
value in C or C++.

A Pascal function corresponds to a function returning a value
in C or C++.

There are functions, like »fopen« that return a value, but are
still named for what they do. This expresses that the main
purpose is deemed to be the action and the value is a
secondary purpose (serving the main purpose by giving a
feedback about the success of the attempted action).

There are functions, like »rand« that have an effect, but
still are named for what they return, because their result is
deemed to be their main purpose, while their effect is deemed
a secondary purpose. (The effect of »rand« is to advance the
random number generator to the next state.)

Naming is especially easy, when a function either only has an
effect or only has a value. In the case of »fopen«, this
separation can be done using OOP as follows:

{ FileOpenAttempt fileOpenAttempt( "source.txt", "r" );
fileOpenAttempt.run();
if( fileOpenAttempt.suceeded() )
{ FILE * file = fileOpenAttempt.result();
use( file );
file.close(); }
else
{ ::std::cerr << fileOpenAttempt.report() << '\n'; }}

Here, »run« is a pure action, while the other element
functions only return a value, but do no action. This is akin
to the structure of natural language, where phrases either
express actions (verbal phrases) or things (noun phrases), but
never both. Insofar, »if( fopen( ... ))« is somewhat
unnatural, but one can get used to it.


==============================================================================
TOPIC: Replace pointer to member functions?
http://groups.google.com/group/comp.lang.c++/t/164c1840e18e0e8a?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Apr 26 2009 6:27 pm
From: Immortal Nephi


Both classes of B1 and B2 are derived from class of A. Class of C is
derived from both classes of B1 and B2. I define "C c;". I create
object arrays which is a pointer to class of A. A pointer to class of
A should be able to invoke B1::Run() and B2::Run() instead of class of
C.
How can you do to fix it? You may suggest to remove class C.
Replace from "virtual public A" to "public A". Then declare static to
class of A's data members.
My answer is no because I want to use multi-threads. Static to data
members is ideal for single-thread. I want to create two separate
object arrays. Each object array can only have a copy of class A's
data members. Class of B1, B2, and C can share class A's data member
each process.

Thanks…

#include <stdio.h>
#include <stdlib.h>

class A
{
public:
A();
~A();

void set_a(int x);
int get_a();
virtual void Run();
virtual void Run2();
virtual void Run3();

private:
int m_a;
};

A::A() : m_a(0)
{
printf("A()\n");
}

A::~A()
{
printf("~A()\n");
}

void A::set_a(int x)
{
m_a = x;
}

int A::get_a()
{
return m_a;
}

void A::Run()
{
printf("A::Run()\n");
}

void A::Run2()
{
printf("A::Run2()\n");
}

void A::Run3()
{
printf("A::Run3()\n");
}

class B1 : virtual public A
{
public:
B1();
~B1();

void set_b1(int x);
int get_b1();
virtual void Run();
virtual void Run2();
virtual void Run3();

private:
int m_b1;
};

B1::B1() : m_b1(0)
{
printf("B1()\n");
}

B1::~B1()
{
printf("~B1()\n");
}

void B1::set_b1(int x)
{
m_b1 = x;
}

int B1::get_b1()
{
return m_b1;
}

void B1::Run()
{
printf("B1::Run()\n");
}

void B1::Run2()
{
printf("B1::Run2()\n");
}

void B1::Run3()
{
printf("B1::Run3()\n");
}

class B2 : virtual public A
{
public:
B2();
~B2();

void set_b2(int x);
int get_b2();
virtual void Run();
virtual void Run2();
virtual void Run3();

private:
int m_b2;
};

B2::B2() : m_b2(0)
{
printf("B2()\n");
}

B2::~B2()
{
printf("~B2()\n");
}

void B2::set_b2(int x)
{
m_b2 = x;
}

int B2::get_b2()
{
return m_b2;
}

void B2::Run()
{
printf("B2::Run()\n");
}

void B2::Run2()
{
printf("B2::Run2()\n");
}

void B2::Run3()
{
printf("B2::Run3()\n");
}

class C : public B1, public B2
{
public:
C();
~C();

void set_c(int x);
int get_c();
virtual void Run();
virtual void Run2();
virtual void Run3();

private:
int m_c;
};

C::C() : m_c(0)
{
printf("C()\n");
}

C::~C()
{
printf("~C()\n");
}

void C::set_c(int x)
{
m_c = x;
}

int C::get_c()
{
return m_c;
}

void C::Run()
{
printf("C::Run()\n");
}

void C::Run2()
{
printf("C::Run2()\n");
}

void C::Run3()
{
printf("C::Run3()\n");
}

int main()
{
C c;

A* pa[2][2]; // Define only one pointer to class A

// B1* pb1 = &c; // Not Needed
// B2* pb2 = &c; // Not Needed

// First Process of thread
pa[0][0] = &c; // How to point to B1 instead of C
pa[0][1] = &c; // How to point to B2 instead of C

// Second Process of thread
pa[1][0] = &c; // How to point to B1 instead of C
pa[1][1] = &c; // How to point to B2 instead of C

// First Process of thread
pa[0][0]->Run(); // Invoke B1::Run() instead of C::Run()
pa[0][1]->Run(); // Invoke B2::Run() instead of C::Run()

// Second Process of thread
pa[1][0]->Run(); // Invoke B1::Run() instead of C::Run()
pa[1][1]->Run(); // Invoke B2::Run() instead of C::Run()


system("pause");

return 0;
}

==============================================================================
TOPIC: U++ 1096
http://groups.google.com/group/comp.lang.c++/t/31d71e8485eda075?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Apr 26 2009 6:56 pm
From: asmcad


On Apr 26, 8:51 am, Mirek Fidler <c...@ntllib.org> wrote:
> Website:http://www.ultimatepp.org
> Download:http://code.google.com/p/upp-mirror/downloads/list
>
> U++ is BSD licensed C++ cross-platform rapid application development
> suite focused on
> programmers productivity without sacrificing runtime performance.
>
> Based on strictly deterministic design it provides an alternative to
> GC collected platforms,
> even for bussines logic oriented problems.
>
> Library
>         Painter: High quality, "SVG/PDF strength" software renderer
>         HttpClient improvements
>         JPGRaster now can read EXIF thumbnails
>         ODBC SQL interface
>         Microsoft SQL Server interface improved
>         Multithreading: ConditionVarable and LazyUpdate classes
>         LocalProcess class
>         RichText: EncodeHTML support for superscript, subscript, strikeout
> and smallcaps
>         Mersenne twister based Random
>
> TheIDE:
>         Win32 .pdb debugger:
>                 shows tooltip with values of variables
>                 improved displaying of strings in pdb debugger
>                 watches are remembered, Clear all watches function, Drag&Drop to
> watches
>         Packages can be sorted by name
>         Packages now can be colored and assigned bold/italic font
>         Package files underlined if recently changed
>         SVN support, SVN history of file
>         Compare with file, compare with patch
>         Assist++
>                 New heurestic error recovery of C++ parser
>                 New code navigator bar
>                 Position of Assist parameter info improved
>                 Context go to (Alt+J) now jumps to layout designer when invoked on
> layout class template
>         Topic++ finished; documentation now visible (and editable) as tooltip
> annotations of sources
>         Abbreviations: e.g. type "i" and press Ctrl+[.] to expand it to if
> () ;
>         Icon editor: free angle rotation
>         "Insert" color or U++ specific includes (.lay, .iml, .tpp group)
>         Print command (of source files)
>         Editor: ToUpper/Lower/InitCaps/SwapCase

I ve tried "TheIDE" it s so complicated. Why didn't you make as other
IDEs

==============================================================================
TOPIC: Simple question
http://groups.google.com/group/comp.lang.c++/t/9bba34aee870db10?hl=en
==============================================================================

== 1 of 1 ==
Date: Fri, Apr 24 2009 3:04 pm
From: "Phlip"


Mosfet wrote:

> std::string GetCurrentPath();
> or
> void GetCurrentPath(const std::string& sCurPath);
>
> In terms of rapidity, memory , ...

Premature optimization is the root of all evil. You should write what works
best for the programmer - typically the first one.

C++ will optimize the std::string constructor to synchronize with the
constructor inside the GetCurrentPath(). They are the same object - that's
the "return value optimization".

But you should write the simplest and most readable code possible, even C++
cannot optimize it. Even if you would get a few extra copies. And you should
write lots of unit tests. After you have a running application, and you can
actually time-test it to see where the real bottlenecks are. They are most
likely not something you would have guessed. These practices free your time
up to focus directly on the parts of your code that actually need the
performance boosts...

--
Phlip

==============================================================================
TOPIC: Supplies polo lacoste t-shirt lowest price ship to worldwide
http://groups.google.com/group/comp.lang.c++/t/2d5c46c2306a211a?hl=en
==============================================================================

== 1 of 2 ==
Date: Sun, Apr 26 2009 7:54 pm
From: mr liu


Supplies polo lacoste t-shirt lowest price ship to worldwide

Dear Sir or Madam: How are you? We are very professional t-shirt
supplier in China, we supply polo t-shirt lacoste t-shirt. more for
your choices. We have all different styles of the t-shirt in the
pictures in stock. They are ready for shipping to you anytime. And the
price is reasonable Welcome to our website: http://www.clothespolo.com
. And you can send us emails.Our MSN and E-mail:
ftrade2009@hotmail.com. Thank you for your time!Looking forward to
your early reply! best regards your sincerely jianguoyang


== 2 of 2 ==
Date: Sun, Apr 26 2009 7:55 pm
From: mr liu


Supplies polo lacoste t-shirt lowest price ship to worldwide

Dear Sir or Madam: How are you? We are very professional t-shirt
supplier in China, we supply polo t-shirt lacoste t-shirt. more for
your choices. We have all different styles of the t-shirt in the
pictures in stock. They are ready for shipping to you anytime. And the
price is reasonable Welcome to our website: http://www.clothespolo.com
. And you can send us emails.Our MSN and E-mail:
ftrade2009@hotmail.com. Thank you for your time!Looking forward to
your early reply! best regards your sincerely jianguoyang

==============================================================================
TOPIC: Cheaper True Religion Men's Jeans - discount
http://groups.google.com/group/comp.lang.c++/t/1cc4800956202f9b?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Apr 26 2009 11:29 pm
From: luoryloy@gmail.com


Our Designer True Religion Men's Jeans are fine quality.
You can check them:
http://www.luxury-fashion.org/static/Apparels/True-Religion-Mens-Jeans-94.html
http://www.luxury-fashion.org/static/Apparels/True-Religion-Mens-Jeans-93.html

Welcome check our other pages or feel free contact us.
You can find what do you want here

==============================================================================
TOPIC: 。◕‿◕。 www.fjrjtrade.com china cheap wholesale nike shoes,air jordan
shoes,air force one shoes.
http://groups.google.com/group/comp.lang.c++/t/bc2b97a9aae722ba?hl=en
==============================================================================

== 1 of 1 ==
Date: Sun, Apr 26 2009 11:36 pm
From: irlychleng


Get Nike Shoes at Super Cheap Prices
Discount Nike air jordans (www.fjrjtrade.com)
Discount Nike Air Max 90 Sneakers (www.fjrjtrade.com)
Discount Nike Air Max 91 Supplier (www.fjrjtrade.com)
Discount Nike Air Max 95 Shoes Supplier (www.fjrjtrade.com)
Discount Nike Air Max 97 Trainers (www.fjrjtrade.com)
Discount Nike Air Max 2003 Wholesale (www.fjrjtrade.com)
Discount Nike Air Max 2004 Shoes Wholesale
(www.fjrjtrade.com)
Discount Nike Air Max 2005 Shop (www.fjrjtrade.com)
Discount Nike Air Max 2006 Shoes Shop (www.fjrjtrade.com)
Discount Nike Air Max 360 Catalogs (www.fjrjtrade.com)
Discount Nike Air Max Ltd Shoes Catalogs (www.fjrjtrade.com)
Discount Nike Air Max Tn Men's Shoes (www.fjrjtrade.com)
Discount Nike Air Max Tn 2 Women's Shoes (www.fjrjtrade.com)
Discount Nike Air Max Tn 3 Customize (www.fjrjtrade.com)
Discount Nike Air Max Tn 4 Shoes Customize
( www.fjrjtrade.com)
Discount Nike Air Max Tn 6 Supply (www.fjrjtrade.com)
Discount Nike Shox NZ Shoes Supply (www.fjrjtrade.com)
Discount Nike Shox OZ Sale (www.fjrjtrade.com)
Discount Nike Shox TL Store (www.fjrjtrade.com)
Discount Nike Shox TL 2 Shoes Store (www.fjrjtrade.com)
Discount Nike Shox TL 3 Distributor (www.fjrjtrade.com)
Discount Nike Shox Bmw Shoes Distributor (www.fjrjtrade.com)
Discount Nike Shox Elite Shoes Manufacturer
(www.fjrjtrade.com)
Discount Nike Shox Monster Manufacturer (www.fjrjtrade.com)
Discount Nike Shox R4 Running Shoes (www.fjrjtrade.com)
Discount Nike Shox R5 Mens Shoes (www.fjrjtrade.com)
Discount Nike Shox Ride Womens Shoes (www.fjrjtrade.com)
Discount Nike Shox Rival Shoes Wholesaler (www.fjrjtrade.com)
Discount Nike Shox Energia Wholesaler (www.fjrjtrade.com)
Discount Nike Shox LV Sneaker (www.fjrjtrade.com)
Discount Nike Shox Turbo Suppliers (www.fjrjtrade.com)
Discount Nike Shox Classic Shoes Suppliers
(www.fjrjtrade.com)
Discount Nike Shox Dendara Trainer (www.fjrjtrade.com)
Discount Nike Air Jordan 1 Seller (www.fjrjtrade.com)
Discount Nike Air Jordan 2 Shoes Seller (www.fjrjtrade.com)
Discount Nike Air Jordan 3 Collection (www.fjrjtrade.com)
Discount Nike Air Jordan 4 Shoes Collection
(www.fjrjtrade.com)
Discount Nike Air Jordan 5 Chaussure Shoes
(www.fjrjtrade.com)
Discount Nike Air Jordan 6 Catalog (www.fjrjtrade.com)
Discount Nike Air Jordan 7 Shoes Catalog (www.fjrjtrade.com)
Discount Nike Air Jordan 8 Customized (www.fjrjtrade.com)
Discount Nike Air Jordan 9 Shoes Customized
(www.fjrjtrade.com)
Discount Nike Air Jordan 10 Wholesalers (www.fjrjtrade.com)
Discount Nike Jordan 11 Shoes Wholesalers (www.fjrjtrade.com)
Discount Nike Air Jordan 12 Factory (www.fjrjtrade.com)
Discount Nike Air Jordan 13 Shoes Factory (www.fjrjtrade.com)
Discount Nike Air Jordan 14 Shoes Sell (www.fjrjtrade.com)
Discount Nike Air Jordan 16 Exporter (www.fjrjtrade.com)
Discount Nike Air Jordan 17 Shoes Exporter
(www.fjrjtrade.com)
Discount Nike Air Jordan 18 Offer (www.fjrjtrade.com)
Discount Nike Air Jordan 19 Shoes Offer (www.fjrjtrade.com)
Discount Nike Air Jordan 20 Manufacture (www.fjrjtrade.com)
Discount Nike Jordan 21 Shoes Manufacture (www.fjrjtrade.com)
Air Jordan Force 3 AJF3 (www.fjrjtrade.com)
Air Jordan Force 4 AJF4 (www.fjrjtrade.com)
Air Jordan Force 5 AJF5 (www.fjrjtrade.com)
Air Jordan Force 6 AJF6 (www.fjrjtrade.com)
Air Jordan Force 7 AJF7 (www.fjrjtrade.com)
Air Jordan Force 8 AJF8 (www.fjrjtrade.com)
Air Jordan Force 9 AJF9 (www.fjrjtrade.com)
Air Jordan Force 12 AJF12 (www.fjrjtrade.com)
Air Jordan Force 23 AJF23Jordan True Flight Shoes
(www.fjrjtrade.com)
Air Jordan DMP Shoes (www.fjrjtrade.com)
Air Jordan Force 25 AJF25 (www.fjrjtrade.com)
Air Jordan Force 24 AJF24 (www.fjrjtrade.com)
Air Jordan Jumpman Pro (www.fjrjtrade.com)
Air Jordan Force 13 AJF13 (www.fjrjtrade.com)

==============================================================================

You received this message because you are subscribed to the Google Groups "comp.lang.c++"
group.

To post to this group, visit http://groups.google.com/group/comp.lang.c++?hl=en

To unsubscribe from this group, send email to comp.lang.c+++unsubscribe@googlegroups.com

To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.lang.c++/subscribe?hl=en

To report abuse, send email explaining the problem to abuse@googlegroups.com

==============================================================================
Google Groups: http://groups.google.com/?hl=en

No comments: