473,387 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

unline instead of outline

When C++ gives the programmer
explicit control over the expansion
of code, it needs a new specifier.
If 'outline' as a specifier is too much
out-of-line, one might consider unline
as the counter part of inline.

class Cloud
{
public:unline rain()
{
//1400 lines of raining code (skipped)
}};

-X
Jul 19 '05 #1
14 2244
Typo in the code. Here is how it
should be:

class Cloud
{
public:unline void rain()
{
//1400 lines of raining code (skipped)
}};

-X
Jul 19 '05 #2
AM> one might consider unline
AM> as the counterpart of inline.

There are other suggestions, notably
!inline or ~inline. Lets have a taste
from all of them:

class Cloud{unline void rain(){}};
class Cloud{outline void rain(){}};
class Cloud{!inline void rain(){}};
class Cloud{~inline void rain(){}};

-X
Jul 19 '05 #3
"Agent Mulder" <mb*******************@home.nl> wrote :
AM> one might consider unline
AM> as the counterpart of inline.

There are other suggestions, notably
!inline or ~inline. Lets have a taste
from all of them:

class Cloud{unline void rain(){}};
class Cloud{outline void rain(){}};
class Cloud{!inline void rain(){}};
class Cloud{~inline void rain(){}};


I think the best place to post these suggestions is comp.std.c++; that
newsgroup is dedicated to the design and standardization of the C++
language.
--
Peter van Merkerk
peter.van.merkerk(at)dse.nl
Jul 19 '05 #4
"Agent Mulder" <mb*******************@home.nl> wrote:
When C++ gives the programmer
explicit control over the expansion
of code, it needs a new specifier.
If 'outline' as a specifier is too much
out-of-line, one might consider unline
as the counter part of inline.

class Cloud
{
public:unline rain()
{
file://1400 lines of raining code (skipped)
}};


Note that even if you define the Cloud class like this, it is still possible
(and in the case of a 1400 line member function even likely) that the
compiler does not inline the code. The "inline" keyword, or a inline
definition is merely a hint to the compiler. The compiler is free to ignore
that hint for whatever reason, and not inline that code anyway.

Also note that these Java style class definitions are not really a good idea
in C++. When any of those 1400 lines changes, all other .cpp files including
the header in which the Cloud class is defined will be recompiled as well.
If the definitions of the member functions are moved to .cpp file, only that
..cpp file needs to be recompiled. Reducing dependencies can speed up
building large projects considerably.

However I do see the logic in your proposal; if you can hint the compiler to
inline code why can you not do the opposite?
--
Peter van Merkerk
peter.van.merkerk(at)dse.nl


Jul 19 '05 #5

"Peter van Merkerk" <me*****@deadspam.com> wrote in message
news:bg************@ID-133164.news.uni-berlin.de...
"Agent Mulder" <mb*******************@home.nl> wrote:
When C++ gives the programmer
explicit control over the expansion
of code, it needs a new specifier.
If 'outline' as a specifier is too much
out-of-line, one might consider unline
as the counter part of inline.

class Cloud
{
public:unline rain()
{
file://1400 lines of raining code (skipped)
}};

[snip]
However I do see the logic in your proposal; if you can hint the compiler to inline code why can you not do the opposite?
--
Peter van Merkerk
peter.van.merkerk(at)dse.nl


Inline is more than a hint to the compiler, its other function is to provide
an exception to the one definition rule. This exception is the main point of
inline, not providing a hint to a compiler.

Features which are purely implementation hints to a compiler and provide no
actual change to the semantics of a program are more or less meaningless and
unlikely to be much used, e.g. the register keyword.

john
Jul 19 '05 #6
MW> 'inline' does *not* give one explicit control
MW> over 'expansion' of code. 'inline' is only
MW> a suggestion, which a compiler may or may not
MW> observe. It's also allowed to inline functions
MW> which are not marked with the 'inline' keyword.

You got the point, Mike. I'm trying to explicitly
disallow the compiler to inline code that is an obvious
candidate for inlining. I found no portable way of
doing that. So now I spread the word on unline.

-X


Jul 19 '05 #7

"Agent Mulder" <mb*******************@home.nl> wrote in message
news:bg**********@news1.tilbu1.nb.home.nl...
MW> 'inline' does *not* give one explicit control
MW> over 'expansion' of code. 'inline' is only
MW> a suggestion, which a compiler may or may not
MW> observe. It's also allowed to inline functions
MW> which are not marked with the 'inline' keyword.

You got the point, Mike. I'm trying to explicitly
disallow the compiler to inline code that is an obvious
candidate for inlining. I found no portable way of
doing that. So now I spread the word on unline.


For what reason?

john
Jul 19 '05 #8
Agent Mulder wrote:

PB> Don't feed the troll.

You posted an invalid solution both on
comp.lang.c++.moderated and on
comp.std.c++.

Huh? In what way is it "invalid" to put 1400 line functions in source
files, where they belong?
I am not trolling


Posting the same thing in multiple newsgroups and ingoring replies is
trolling.

--

"To delight in war is a merit in the soldier,
a dangerous quality in the captain, and a
positive crime in the statesman."
George Santayana

"Bring them on."
George W. Bush
Jul 19 '05 #9
PB> That's been suggested at least four times in two other newsgroups. He
PB> hasn't replied to it anywhere else, except in his message to me in this
PB> newsgroup saying it's "invalid."

I copied this reply from from the thread
Re: turn off inlining using extern "C", on
comp.lang.c++.moderated:

Heinz Ozwirk:
If you want to prevent functions from being inlined, put them in separate
.cpp (or whatever) files and only include their prototypes in the code
that calls them. The compiler cannot inline them, if it doesn't know what
to inline.


Francis GlassBorow:
Of course it can and good linkers have been managing that for some time.
In future it will become more common as forms of semi-compiled code
become more common. VC++7 has some quite clever features in this area.

Agent Mulder again:
The conclusion in that thread is that there is no
portable way to ensure that code gets expanded
outline (not inline). It is viewed as a de-optimization
enforced by the programmer. Your hack of taking
the function body out of the class declaration does
not work. Fix it! :-)

-X

Jul 19 '05 #10
Agent Mulder wrote:

PB> That's been suggested at least four times in two other newsgroups. He
PB> hasn't replied to it anywhere else, except in his message to me in this
PB> newsgroup saying it's "invalid."

I copied this reply from from the thread
Re: turn off inlining using extern "C", on
comp.lang.c++.moderated:

Heinz Ozwirk:
If you want to prevent functions from being inlined, put them in separate
.cpp (or whatever) files and only include their prototypes in the code
that calls them. The compiler cannot inline them, if it doesn't know what
to inline.


Francis GlassBorow:
Of course it can and good linkers have been managing that for some time.
In future it will become more common as forms of semi-compiled code
become more common. VC++7 has some quite clever features in this area.

Agent Mulder again:
The conclusion in that thread is that there is no
portable way to ensure that code gets expanded
outline (not inline). It is viewed as a de-optimization
enforced by the programmer. Your hack of taking
the function body out of the class declaration does
not work. Fix it! :-)


Okay. Perhaps you should change your example so that you don't tell the
compiler to inline your function. Then you might have a better example
for your proposed 'uninline.' But if you do that then you'll have to
explain why you think a compiler might inline your 1400 line function
and why, if the compiler does that, it's something that requires a
language change.

--

"To delight in war is a merit in the soldier,
a dangerous quality in the captain, and a
positive crime in the statesman."
George Santayana

"Bring them on."
George W. Bush
Jul 19 '05 #11
Mike Wahler wrote:

Pete Becker <pe********@acm.org> wrote in message
news:3F***************@acm.org...
Agent Mulder wrote:

PB> Don't feed the troll.

You posted an invalid solution both on
comp.lang.c++.moderated and on
comp.std.c++.


Huh? In what way is it "invalid" to put 1400 line functions in source
files, where they belong?


I don't suppose I could get away with calling it 'invalid',
but imo 1400 lines in a single function is, well, foolish.


Well, sure, but that's not the issue.

--

"To delight in war is a merit in the soldier,
a dangerous quality in the captain, and a
positive crime in the statesman."
George Santayana

"Bring them on."
George W. Bush
Jul 19 '05 #12
Peter>Note that even if you define the Cloud class like this,
Peter>it is still possible (and in the case of a 1400 line member
Peter>function even likely) that the compiler does not inline the code.

Hoi Peter, thank you and the others for your replies.
I deviced a program with 1400 lines of initialization
code and under Borland 5.5 it does indeed gratify
the 'request' to inline:

#include <iostream>
#define I std::cout<<"drip drip drop drip ";
#define X I I I I I I I I I I
#define C X X X X X X X X X X
#define M C C C C C C C C C C
class Cloud
{
public:Cloud()
{
M C C C C //1400 lines of initialization code
for(;!true;); //comment this out and size doubles
}};
int main(int argc,char**argv)
{
Cloud a,b,c,d,e,f,g,h,i,j,k,l,m;//,n,o,p,q,r,s,t,u,v,w,x,y,z;//linker gives
up
return 0;
}

-X
Jul 19 '05 #13
AM> You posted an invalid solution...!!!

Sorry Pete. There was no need be that short. It's
just that I unsize for a troll :-)

-X
Jul 19 '05 #14
"Agent Mulder" <mb*******************@home.nl> wrote in message
news:bg**********@news1.tilbu1.nb.home.nl...
Peter>Note that even if you define the Cloud class like this,
Peter>it is still possible (and in the case of a 1400 line member
Peter>function even likely) that the compiler does not inline the code.

Hoi Peter, thank you and the others for your replies.
I deviced a program with 1400 lines of initialization
code and under Borland 5.5 it does indeed gratify
the 'request' to inline:

[snip]

Dag meneer "Mulder",

To my surprise Borland 5.5 indeed honors the inline request even though the
function consists of 1400 lines(!). I compiled your code with Microsoft
Visual C++ 6.0 as well. I inspected the assembler output and even at its
most aggressive optimization setting (which can also inline functions not
explicitly declared inline) this compiler simply refuses to inline the
function. This makes sense as inlining functions is mostly done to avoid the
function call overhead (which can be significant with simple getter/setter
functions). On a 1400 line function, the function call overhead would be
completely insignificant. In this case inlining does not only make the
program larger, but probably also slower. Cache misses are more likely to
occur if due to inlining code is spread over a larger memory area. So I
think the Microsoft compiler made the best choice here, though as far as the
standard is concerned both compilers are right in this respect.

--
Peter van Merkerk
peter.van.merkerk(at)dse.nl

Jul 19 '05 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Agent Mulder | last post by:
I feel the need for an outline specifier to facilitate java-style programming.
4
by: Doors of Perception | last post by:
As you probably know, when you click on a link in MSIE and go to a page, then when you click the "back" button, you see a dotted box outlining the link on which I just clicked. As far as I'm...
20
by: Chris Bradbury | last post by:
Hi, I'm posting in this forum for the first time so if I break any conventions or protocols I'm sorry. I've attached this style: *:focus { outline: none } to a page but it doesn't remove...
6
by: Altramagnus | last post by:
I have n number of circles. Some of them might overlap. I need to draw the outline of all circles but not those overlap areas. Initially, I am try to use a Region, because a Region object has a...
5
by: Felix Collins | last post by:
Hi All, does anyone know any cleaver tricks to sort a list of outline numbers. An outline number is a number of the form... 1.2.3 they should be sorted in the following way... 1 1.1 1.2
1
by: John Doe | last post by:
I collapse an outline block, then copy it, then paste it. In my experience, the outline block always expands after the paste. Is their a way to modify the editor's behavior so that an outline block...
13
by: deko | last post by:
I. A. B. II. A. 1) 2) B. C.
4
by: Rex | last post by:
Hi - I am new to VB.Net/2005, but not VB. I am trying to find an outline or tree - type control for VB.Net/2005 that provides the ability for the User to TYPE in one of the NODES of the outline......
2
by: Joel Byrd | last post by:
I want to get a red outline around different divs on a page when I hover the mouse over them, and then have the red outline disappear on mouse out (basically to indicate that various elements on...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.