473,404 Members | 2,137 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,404 software developers and data experts.

Inline and template file extensions?

Hi,

I was wondering if there are standard conventions about the extensions
to be used for files that contain:
(1) inline implementations
(2) template implementations
(3) inline template implementations
It seems like most people use .inl for (1) and some use .tpl for (2),
but I only find 1 reference to .tnl files for (3).
So, any standards/conventions for these?

Koen
Jul 22 '05 #1
4 5551
Koen wrote:
Hi,

I was wondering if there are standard conventions about the extensions
to be used for files that contain:
(1) inline implementations
(2) template implementations
(3) inline template implementations


Come to think of it: since template implementations are always inlined
(correct me if I'm wrong), maybe it makes sense to consider template
implementations as inline code tout court (so also use .inl instead of
..tpl)? Or is there a reason why I should still consider them as separate
things (and keep the .inl and .tpl distinction)?

Koen
Jul 22 '05 #2
"Koen" <no@ssppaamm.com> wrote in message news:<c8**********@gaudi2.UGent.be>...
Koen wrote:
Hi,
....
Come to think of it: since template implementations are always inlined
(correct me if I'm wrong), maybe it makes sense to consider template
implementations as inline code tout court (so also use .inl instead of
.tpl)? Or is there a reason why I should still consider them as separate
things (and keep the .inl and .tpl distinction)?


I seem to remember that MS uses .inl extensions for some type of file.
So in an effort to keep it more C++ish, I try to use the common .hpp,
..hxx and .cpp extensions.

hpp is normally a C++ header file
hxx is usually has inlinable (or template impl) code
cpp is generally the implementation

If you really need flexibility, use a macro in place of the keyword
'inline' and at compilation time, (via macros again) you can include
the .hxx content in either the header or implementation file, inlined
or not per your INLINE macro.

At any rate, these decisions are arbitrary - but easy to remember and
great at keeping Emacs a happy camper.

Hth,

-Luther
Jul 22 '05 #3

"Koen" <no@ssppaamm.com> wrote in message
news:c8**********@gaudi2.UGent.be...
Hi,

I was wondering if there are standard conventions about the extensions
to be used for files that contain:
(1) inline implementations
(2) template implementations
(3) inline template implementations
It seems like most people use .inl for (1) and some use .tpl for (2),
but I only find 1 reference to .tnl files for (3).
So, any standards/conventions for these?


I would use .h for all of them. The most important distinction is between
files that are directly compiled and those that are included. At a push I
might be prepared to use .hpp for C++ headers and .h for C compatible
headers.

Anything else is over elaboration I think.

john
Jul 22 '05 #4
"John Harrison" <jo*************@hotmail.com> wrote in message news:<2h************@uni-berlin.de>...
"Koen" <no@ssppaamm.com> wrote in message
news:c8**********@gaudi2.UGent.be...
Hi,

I was wondering if there are standard conventions about the extensions
to be used for files that contain:
(1) inline implementations
(2) template implementations
(3) inline template implementations
It seems like most people use .inl for (1) and some use .tpl for (2),
but I only find 1 reference to .tnl files for (3).
So, any standards/conventions for these?

I would use .h for all of them.


Hi John,

It follows from your suggestion, (assuming the OP's original goal to
separate the header and inline implementation) that you'd have to
rename the inline implementation file since both the header and
inline/template implementation files would use the .h extension.

So, either you're arguing for

a) *not* separating inline or template implementations from the
header in which they are declared - thereby keeping them in the same
file.

b) or you don't mind using new file names for related header and
inline/template implementations.

Regarding these two suggestions:

a) I think the OP's question was asking for good name suggestions
for separate header and inline files. Just to be clear, your
suggestion says "don't do it". See below.

b) I don't think you're arguing for this - but an additional name
for inline implementation files doesn't seem any better than using a
different postfix, such as those the poster originally suggested. IE:
somestuff.h, somestuff-inline.h, somestuff.cpp doesn't seem to fix
anything.
Anything else is over elaboration I think.


Thats a pretty broad generalization. Different projects have different
requirements. The ACE Networking Library separates potential inline
implementations for reasons I stated in an early post. Sometimes
implementations need to compile with the .cpp files -- and other times
the implementation can be inlined and included with the .h file.
Depends on the context/requirements.

-Luther
Jul 22 '05 #5

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

Similar topics

2
by: Jeff Williams | last post by:
The common method of defining template classes and functions is to put the definition and declaration into the same header file. Or at least I believe it to be the common method and it is...
7
by: Senthilraja | last post by:
I have the following program using templates. Someone please let me know the syntax to be used for defining the member functions push, pop etc. as non-inline functions. #include <iostream>...
6
by: RainBow | last post by:
Greetings!! I introduced the so-called "thin-template" pattern for controlling the code bloat caused due to template usage. However, one of the functions in the template happens to be virtual...
9
by: GJ | last post by:
The performance can be DEGRADED by making a function "inline". Is it TRUE in any case ? -- GJ
30
by: Will Pittenger | last post by:
Does C# inline functions? I do not see a inline keyword. Is there an implicit inline? Can the compiler select functions for auto-inlining? I am more used to C++ where all these things are...
6
by: Sharon | last post by:
Usually it is common to write the class member function in the class H file, but some people like to write the function body in the C++ file. Can anybody tell me what are the cases where inline...
4
by: John Goche | last post by:
Hello, I have been going through several header source files which define classes with inline functions. In the case where the inline functions are not defined in place, the inline functions...
32
by: Immortal Nephi | last post by:
I want to know if the practice is the best. Do I need to place inline keyword inside class definition or outside member function definition. For example class A { public: A(); ~A();
17
by: Juha Nieminen | last post by:
As we know, the keyword "inline" is a bit misleading because its meaning has changed in practice. In most modern compilers it has completely lost its meaning of "a hint for the compiler to inline...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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:
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...
0
isladogs
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 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.