Hi,
I'm currently learning C++ and I would like to ask you the difference
between Fortran 95 modules and C++ namespaces. To me they look the
same, except for the scope operator :: in C++, which is a bit more
convenient than F95 rename operator =>, to avoid name clashes. Thank
you,
greetings,
deltaquattro 2 2303
In comp.lang.fortr an deltaquattro <de**********@g mail.comwrote:
I'm currently learning C++ and I would like to ask you the difference
between Fortran 95 modules and C++ namespaces. To me they look the
same, except for the scope operator :: in C++, which is a bit more
convenient than F95 rename operator =>, to avoid name clashes. Thank
C++ namespaces are extendible, Fortran modules aren't. Once
you reach the "end module" statement, that's the end of it.
In C++ you can reopen the namespace scope and pile more stuff
into it.
That's one difference. I would be surprised if there aren't many
more. Analogies between Fortran and C++ (or C) are often more
misleading than helpful, so beware.
--
pa at panix dot com
On 14 feb, 16:45, p...@see.signat ure.invalid (Pierre Asselin) wrote:
In comp.lang.fortr an deltaquattro <deltaquat...@g mail.comwrote:
I'm currently learning C++ and I would like to ask you the difference
between Fortran 95 modules and C++ namespaces. To me they look the
same, except for the scope operator :: in C++, which is a bit more
convenient than F95 rename operator =>, to avoid name clashes. Thank
C++ namespaces are extendible, Fortran modules aren't. Once
you reach the "end module" statement, that's the end of it.
In C++ you can reopen the namespace scope and pile more stuff
into it.
That's one difference. I would be surprised if there aren't many
more. Analogies between Fortran and C++ (or C) are often more
misleading than helpful, so beware.
Well, you can join Fortran modules into a new module:
module composite
use module_a
use module_b
...
end module
The new module has all the facilities of the individual ones.
(And interfaces can be defined piecewise as well).
I am not familiar enough with C++'s namespaces to comment on them.
My mental picture of modules is that they do not induce a hierarchy,
but rather import facilities into the current scope and blend them
in seemlessly. I do not think namespaces in C++ work just like that.
Regards,
Arjen This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Andy Jewell |
last post by:
Does anyone know of a way to dynamically reload all the imported modules of a
client module?
I'm writing a program that I have broken down into quite a few submodules, and
the 'configuration' is done with modules too. As I am developing the app, I
need to test bits and pieces here and there. This is what I currently do:
In each...
|
by: Dan Williams |
last post by:
Hi people
I've just joined the Python list and although I'm sure my question must be
asked fairly frequently, I have been unable to find an answer after two days
of searching. For the record, my total Python experience is also two days :)
(I come from a C++ background though, so I have good programming knowledge
in general).
My question...
|
by: Bart |
last post by:
Hi all
I don't understand globals between multiple modules in a python program. I
really don't. I've narrowed it down to the following two very simple
programs a.py and b.py. When I run a.py I get the following output:
inc: 2
A: 2
inc: 3
B: 3
|
by: qwweeeit |
last post by:
The pythonic way of programming requires, as far as I know, to spread a
big application in plenty of more manageable scripts, using import or
from ... import to connect the various modules.
In some cases there is a further complication: module importing through
an indirect mechanism, like: exec "from " + xxx + " import *".
A part the fact...
|
by: Ben R. |
last post by:
Hello,
I’m in the process of reading "Inside Microsft .NET IL Assembler" by Serge
Lidin to gain a better understanding of my .NET code at a lower (IL) level.
There is one concept that I am having trouble grasping, however: Assemblies
versus modules and how they relate to one another. From what I can tell,
assemblies contain one or...
| |
by: Alex |
last post by:
Hi, this is my first mail to the list so please correct me if Ive done
anything wrong.
What Im trying to figure out is a good way to organise my code. One
class per .py file is a system I like, keeps stuff apart. If I do
that, I usually name the .py file to the same as the class in it.
File: Foo.py
***********************
class Foo:
|
by: Neil Cerutti |
last post by:
The Glk API (which I'm implementing in native Python code)
defines 120 or so constants that users must use. The constants
already have fairly long names, e.g., gestalt_Version,
evtype_Timer, keycode_PageDown.
Calls to Glk functions are thus ugly and tedious.
scriptref = glk.fileref_create_by_prompt(
glk.fileusage_Transcript |...
|
by: Zytan |
last post by:
I've read the docs on this, but one thing was left unclear. It seems
as though a Module does not have to be fully qualified. Is this the
case? I have source that apparently shows this.
Are modules left-over from VB6, and not much used anymore? It seems
that it is better to require Imports or use fully qualified names for
functions in...
|
by: Fabrizio Pollastri |
last post by:
Hi,
just an import problem:
a program imports two modules, modA and modB, each module do not known anything
about the other module (i.e. no cross imports in them), both modules needs to
refer to some functions that are defined in the global namespace of the other
module. There is a possible solution? In other words, can the importing...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
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 we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |