473,776 Members | 1,505 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Proto-Functions: Declaring in one file, using in another?

I have a file where I'm putting a lot of variable definitions. Some of them
will be maps that include references to functions. This file will be
processed (by include) before other files are processed.

If I put protofunction definitions in this definition file and the actual
functions in another file, are there any non-obvious consequences to this?

Thanks!

Hal
Mar 14 '08 #1
2 1832
On Mar 14, 2:49*pm, Hal Vaughan <h...@halblog.c omwrote:
I have a file where I'm putting a lot of variable definitions. *Some of them
will be maps that include references to functions. *This file will be
processed (by include) before other files are processed.

If I put protofunction definitions in this definition file and the actual
functions in another file, are there any non-obvious consequences to this?
There are some significant consequences, some that you may or may not
care about.

The FAQ has alot on include files. If it does not satsify your
questions, please post a more specific question.
Mar 14 '08 #2
On Mar 14, 4:49 am, Hal Vaughan <h...@halblog.c omwrote:
I have a file where I'm putting a lot of variable definitions.
Some of them will be maps that include references to
functions. This file will be processed (by include) before
other files are processed.
If I put protofunction definitions in this definition file and
the actual functions in another file, are there any
non-obvious consequences to this?
It depends on what you mean by "non-obvious". In general, any
time you expect to use the name of a function in a source file
other than where it is defined, you should put its declaration
in a separate header file, to be included both in the source
file where you define the function, and in all other source
files which use it. And make sure that all of the objects whose
source file includes that header (directly or indirectly) are
declared as depending on it in the make file---most versions of
make have different astuces to help automate this. (And any
time you don't expect to use the name of a function in another
source file, of course, you should put the function in an
anonymous namespace.)

--
James Kanze (GABI Software) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Mar 14 '08 #3

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

Similar topics

105
5203
by: Peter Hickman | last post by:
Well after all this discussion it would appear that a 'Python like' language has appeared => Prothon. http://www.prothon.org/index.html Very alpha, sort of like Python (if you consider the indenting is what makes Python unique) and sort of Ruby in its use of prefixes to define scoping etc (although there is no reference to this trait being borrowed from Ruby). It also quotes Self as being an influence.
7
3563
by: Michele Simionato | last post by:
So far, I have not installed Prothon, nor I have experience with Io, Self or other prototype-based languages. Still, from the discussion on the mailing list, I have got the strong impression that you do not actually need to fork Python in order to implement prototypes. It seems to me that Python metaclasses + descriptors are more than powerful enough to implementing prototypes in pure Python. I wrote a module that implements part of what...
14
2529
by: greg | last post by:
Discussion is invited on the following proto-PEP. ------------------------------------------------------------- PEP ??? - Overloadable Boolean Operators ======================================== SUMMARY This PEP proposes an extension to permit objects to define their own
1
3261
by: fedor | last post by:
Hi all, happy new year, I was trying to pickle a instance of a subclass of a tuple when I ran into a problem. Pickling doesn't work with HIGHEST_PROTOCOL. How should I rewrite my class so I can pickle it? Thanks , Fedor
35
3685
by: Troll | last post by:
Hi, I need to write a script which reads some data and reports the findings. Just to give you an idea the structure is similar to the following. Data input example: HEADING 1 ********** ColumnA ColumnB ColumnC ColumnD ColumnE
3
2527
by: Philippe Guglielmetti | last post by:
Look at these few lines of code: class A { public: virtual void f() { cout << "A";}}; class B : public A{public: static void f() { cout << "B"; }}; class C : public B{public: void f() { cout << "C"; }}; // virtual or not ? that's the question... int main(int, char**) { A* x; A a; B b; C c;
7
1320
by: Kay Schluehr | last post by:
I want to manipulate a deeply nested list in a generic way at a determined place. Given a sequence of constant objects a1, a2, ..., aN and a variable x. Now construct a list from them recursively: L = ]...]] The value of x is the only one to be changed. With each value of x a new instance of L is needed so that we actually have a function: L = lambda x: ]...]]
2
1375
by: ian | last post by:
Hi; What is void daily_log(char *, ...); saying, the 3 periods? Regards Ian
8
2161
by: chuwfan | last post by:
Good day every one, i just try to develop a sip proxy with mjsip's library, now i am facing problem, 1st, the client is connected to proxy, but it can make call (VoIP) to another client, the client i using to test is the window messenger 5.1 (with sip support). anybody can help me look on the code and try to tell me what is going wrong pls.. the packet of the client send to proxy just stop at the updateProxingResponse method then the...
1
2073
by: jrefran | last post by:
Hi everyone! I have problem on my DBD:Oracle installation from source code. Does anyone familiar with this kind of error. Please help! I'm completely new with this kind of work item. This is the error during execution of "make". This error was in the last part. ---------------------------------- /usr/local/lib/perl5/5.8.8/sun4-solaris/CORE/proto.h:2089: warning: `__malloc__' attribute dir ective ignored...
0
9628
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, 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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9464
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9923
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8952
agi2029
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6722
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5367
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5493
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4031
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
2
3622
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.