I'd like a tool that performed inlining of function bodies of which do
not appear in the .h file.
Really.
gcc on Linux.
Yakov 8 1494
Yakov wrote:
I'd like a tool that performed inlining of function bodies of which do
not appear in the .h file.
You want to inline all functions that do not appear in the .h???
suppose:
inline int fn(int a)
{
if (a == 5998)
return 59;
else if (a >= 55)
return 23;
else {
while (a < 52)
a = a*a;
goto followup;
}
followup:
return a;
}
Now, you have:
int a;
....
fn(a);
fn(a+78);
You have to replace the "returns" in the function body to some generated
label.
Then, you have to replace all variables by local variables
Then, you have to replace all label names with some generated labels
so that the labels do not collide.
It looks like a lot of work for such a tool isn't it?
jacob
On Jun 26, 1:21 am, jacob navia <j...@jacob.remcomp.frwrote:
Yakov wrote:
I'd like a tool that performed inlining of function bodies of which do
not appear in the .h file.
You want to inline all functions that do not appear in the .h???
I did not say "all functions". Inlining must be smart.I started to use
gcc's 'static inline' trick to put function bodies into .h files (and
yes, gcc knows to do inlining -- but practically , you need to put
function body into .h file).
I find it inconvenient to put function bodies into .h files.
It looks like a lot of work for such a tool isn't it?
gcc already does it, what you describe as "lot of work.
My problem is, I want inlinking *AND* keeping
function bodies in the .c files.
Yakov
jacob navia wrote:
Yakov wrote:
>I'd like a tool that performed inlining of function bodies of which do not appear in the .h file.
You want to inline all functions that do not appear in the .h???
suppose:
inline int fn(int a)
{
if (a == 5998)
return 59;
else if (a >= 55)
return 23;
else {
while (a < 52)
a = a*a;
goto followup;
}
followup:
return a;
}
Now, you have:
int a;
...
fn(a);
fn(a+78);
You have to replace the "returns" in the function body to some generated
label.
Then, you have to replace all variables by local variables
Then, you have to replace all label names with some generated labels
so that the labels do not collide.
It looks like a lot of work for such a tool isn't it?
(fx:shrug) A tool has to do whatever it has to do to provide the service
it's advertised as providing. It doesn't have to be /easy/.
A better difficulty example is a recursive function that isn't tail-
recursive.
--
Hewlett-Packard Limited Cain Road, Bracknell, registered no:
registered office: Berks RG12 1HN 690597 England
Chris Dollin wrote:
jacob navia wrote:
>Yakov wrote:
>>I'd like a tool that performed inlining of function bodies of which do not appear in the .h file.
You want to inline all functions that do not appear in the .h???
suppose:
inline int fn(int a) { if (a == 5998) return 59; else if (a >= 55) return 23; else { while (a < 52) a = a*a; goto followup; } followup: return a; }
Now, you have: int a;
...
fn(a); fn(a+78);
You have to replace the "returns" in the function body to some generated label. Then, you have to replace all variables by local variables Then, you have to replace all label names with some generated labels so that the labels do not collide.
It looks like a lot of work for such a tool isn't it?
(fx:shrug) A tool has to do whatever it has to do to provide the service
it's advertised as providing. It doesn't have to be /easy/.
A better difficulty example is a recursive function that isn't tail-
recursive.
And MANY others. I have still not completely finished this part in
lcc-win32...
There is (for instance) the problem that all static variables
within an inline function should point to the same storage,
and a long ETC!
Not to mention the parsing of C, the preprocessor, etc.
That tool can be only one thing:
A COMPILER!
Yakov wrote:
On Jun 26, 1:21 am, jacob navia <j...@jacob.remcomp.frwrote:
>Yakov wrote:
>>I'd like a tool that performed inlining of function bodies of which do not appear in the .h file.
You want to inline all functions that do not appear in the .h???
I did not say "all functions". Inlining must be smart.I started to use
gcc's 'static inline' trick to put function bodies into .h files (and
yes, gcc knows to do inlining -- but practically , you need to put
function body into .h file).
I find it inconvenient to put function bodies into .h files.
>It looks like a lot of work for such a tool isn't it?
gcc already does it, what you describe as "lot of work.
Excuse me but you think that gcc wasn't a lot of work to write???
Or you mean that if gcc does clever optimization "XYZ"
it is NOT a lot of work to reproduce that???
Your logic is completely weird.
My problem is, I want inlinking *AND* keeping
function bodies in the .c files.
In your .h file write:
#include "inlines1.c"
and be done with it!
jacob
Yakov <il*****@gmail.comwrites:
On Jun 26, 1:21 am, jacob navia <j...@jacob.remcomp.frwrote:
>Yakov wrote:
I'd like a tool that performed inlining of function bodies of which do
not appear in the .h file.
You want to inline all functions that do not appear in the .h???
I did not say "all functions". Inlining must be smart.I started to use
gcc's 'static inline' trick to put function bodies into .h files (and
yes, gcc knows to do inlining -- but practically , you need to put
function body into .h file).
I find it inconvenient to put function bodies into .h files.
>It looks like a lot of work for such a tool isn't it?
gcc already does it, what you describe as "lot of work.
My problem is, I want inlinking *AND* keeping
function bodies in the .c files.
gcc implements inline functions, but it doesn't do so by transforming
the C source, which I *think* is what you're looking for.
Actually, can you be more specific about what you want? The simplest
way to inline a C function is to add an "inline" keyword to its
definition (assuming you have a compiler that supports that).
Stepping back a bit, are you sure that inlining these functions is
going to be worthwhile? Is your program not fast enough as it is?
Have you measured it?
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Yakov wrote:
>
I'd like a tool that performed inlining of function bodies of
which do not appear in the .h file. Really. gcc on Linux.
Use static inline descriptors, and std=C99.
--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
cbfalconer at maineline dot net
--
Posted via a free Usenet account from http://www.teranews.com
On Tue, 26 Jun 2007 12:11:42 -0000, in comp.lang.c , Yakov
<il*****@gmail.comwrote:
>I'd like a tool that performed inlining of function bodies of which do not appear in the .h file.
You're wasting your time. The compiler optimiser will already be able
to do this for any function that can be appropriately optimised. If it
can't be optimised, and the "inline" hint will tell the compiler to
try, then you are unlikely to do better.
>Really.
Its also a /lot/ of work.
--
Mark McIntyre
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tony Vitonis |
last post by:
From what I can tell, VB.NET doesn't allow programmers to say
explicitly that they want a function to be inlined. Now, I'm a big fan
of factoring out duplicate code, but I don't want to do too...
|
by: glen_stark |
last post by:
Hi.
I'm just curious if there any warnings or caveats or whatever to be
aware of when inlining function object calls? If the answer is no, they
inline just like everything else, that's good...
|
by: ben |
last post by:
is it true that a function without an inline keyword never get inlined? If
not true when is it inlined or not?
ben
|
by: Generic Usenet Account |
last post by:
While I have a very good feel for how inlining works, I fail to see how
in the world inlining can work if the inlined function is not described
"in place" in a header file, but rather defined in a...
|
by: Raphael |
last post by:
Hello,
I have 2 files
A.c : Defining a bunch of usefull functions
B.c : Defining a main that uses these ones.
I need to improve perfs :
I know that, if the caller and the functions called...
| |
by: Brian Keating |
last post by:
Hello there,
I'm having a slight problem in that my JIT compiler is getting an exception
and I really don't know how to stop it.
Let me expain what's happening with the help of this simple test...
|
by: clintonG |
last post by:
I'm using an .aspx tool I found at but as nice as the interface is I
think I need to consider using others. Some can generate C# I understand.
Your preferences please...
<%= Clinton Gallagher
...
|
by: Elpoca |
last post by:
Hi:
What rules govern the inlining of templated functions and templated
class methods?
It has always been my understanding that both templated functions and
templated class methods were...
|
by: LuB |
last post by:
How judicious ought one be when inlining small methods.
I once read that in general, most compiles will only inline 'one'
level.
IE: if all the following methods were declared/defined as...
|
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,...
|
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...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |