ok,ok, thank you, don't worry , I still don't understand how to define what how where by which, I'm too old for this kind of rock'n roll.

Don't try to teach me, it's not worth while - I won't get how to do it anyway.

Maybe the developers will produce a linker one day and some basic libraries and headerfiles instead of all those currently hidden background pragma and whatever stuff, and all will be fine

As long as you have your towel, you'll be fine.

_________________Jeff McBrideBenson Robotics Club

Mon Sep 22, 2008 12:34 pm

Dick Swan

Creator

Joined: Fri Feb 09, 2007 9:21 amPosts: 615

Re: How to tell if a file is included

Quote:

I'm sorry but now you've lost me. What are you trying to do in RobotC that isn't working the way you expect? Can you give us a concrete example? The only truely weird thing about RobotC is that every program has one source file which may or may not have include files. In standard C a program is usually compiled from multiple source files each of which may or may not have include files. This is an unfortunate but understandable limitation.

This is a byproduct of one of the early design decisions for ROBOTC. It also happens to be the way that Interactive C works; many of the concepts behind ROBOTC were based on some of the groundbreaking concepts developed for IC.

Sytems designed for commercial development tend to have "projects" or "make files" that among other things contain lists of source files that make up a project. With ROBOTC the typical project is a single source file. So we looked at "How Can we simplify the user experience when the typical project is a single file?". This led to eliminatin of "makefile" concept, elimination of linker -- include the functionality in the compiler, etc. It made for easier sharing of programs -- simply transfer a single file rather than a makefile and hopefully all the constituent source files.

For larger projects, you can use multiple "#include" statements. Not as elegant as a larger system, but still workable.

Mon Sep 22, 2008 6:49 pm

Ford Prefect

Guru

Joined: Sat Mar 01, 2008 12:52 pmPosts: 1030

Re: How to tell if a file is included

Robot C is based on Interactive C?Did YOU write the programming language for the Rug Warrier

This was a big leap for robot programmers - 15 years ago?

but nowadays, the platforms became larger and more powerful, the claims have risen, the horizons broaded, the programming language must grow with his duties, and finally no one is forbidden to learn from earlier mistakes...maybe some of earlier decisions have to be reconsidered.

... It made for easier sharing of programs -- simply transfer a single file rather than a makefile and hopefully all the constituent source files.

For larger projects, you can use multiple "#include" statements. Not as elegant as a larger system, but still workable.

Hi Dick,

I don't have a problem with the "single source file + includes" model. However, the #ifndef FOO statements at the begining of the RobotC include files do not work because the compiler is simply refusing to open the file a second time. So, instead of harmlessly skipping the redundant include it is causing compilation errors. It is possible to work around the problem by putting the #ifndefs around the #includes instead of inside the include files themselves but it is inelegant and puts the burden on the user (programmer) instead of on the author (library writer).

It would be nice if the compiler treated the redundant includes as warnings instead. "Ignoring file FOO as it has already been included earlier" or some such thing.

I myself am ok with one source file. But other people might want to use a makefile.

P.S. Don't let them. I doubt that the NXT has the required space for the projects that they intend to make.

_________________Sorry, your program could not be downloaded. Please reboot your computer.FTC Team #2959 Team Smash Bros CLICK HERE.(or click www)

Quote:

What the world needs is more geniuses with humility, there are so few of us left.

Agreed

Mon Sep 22, 2008 7:18 pm

Ford Prefect

Guru

Joined: Sat Mar 01, 2008 12:52 pmPosts: 1030

Re: How to tell if a file is included

I DO want only 1 source file.But I also like to have some libraries and header files.Today all libraries are included, hidden, inside the compiler (math.lib, sort of stdio or a graph.lib, ...) - why not write them as extra files, include them to the main file and other self written headers and libs, and link them and make them executable by makefile?where is the difference?at least the transparency and the flexibility are growing.

Robot C is based on Interactive C?Did YOU write the programming language for the Rug Warrier

This was a big leap for robot programmers - 15 years ago?

but nowadays, the platforms became larger and more powerful, the claims have risen, the horizons broaded, the programming language must grow with his duties, and finally no one is forbidden to learn from earlier mistakes...maybe some of earlier decisions have to be reconsidered.

A linker and a makefile could be fine today

ROBOTC is not based on IC. BUt I did look at some of the design principles behind IC for those that IMHO made good sense.

If you want to write programs that have 10s of thousands of lines of code, then ROBOTC is not the best choice. But the vast majority of end user applications are in the order of 100 line of user written code. ROBOTC is a great solution for this.

When you can simply recompile everything in a couple of seconds, you may not need the complexity of a linker.

The ROBOTC design team believes the paradigm of one project == one file is very appropriate to the vast majority of ROBOTC users.

Of course, ROBOTC works pretty good for power users as well. And features have been added for this demographic as well. Like the recent "__FILE__"" and "__MAIN__" capabilities; and the "find in all files" command. And the ability to select any souce file -- both user and system #include files -- from the VIEW menu when in "Advanced" or "Super User" menu.

Mon Sep 22, 2008 10:50 pm

Ford Prefect

Guru

Joined: Sat Mar 01, 2008 12:52 pmPosts: 1030

Re: How to tell if a file is included

hello,thx for your reply.ok, I understood, you won't change the current neither-linker-nor-makefile-concept never.

So I have to reconsider my decision, that __FILE__ and __MAIN__ won't be a solution for my program architecture: I came to a point where I need double an crosswise file references.So it can't avoid to ask you- if you please may have a look at my 2 examples of 3 corrsponding files each that I posted above and- show me please how those cross references look like if you use __FILE__ and __MAIN__ .

thx and regards!

PS:my neural net and my navigator both have currently about 1100-1400 lines, to be increased by further ~500 lines of header files

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum