Curly bracket question

Doom and Gloom ( and couple glasses of wine).

Last night I just compiled my little project, with the 4k limited Raisonance C complier for the 8051/2

" missing } " it said, you have been naughty

I counted all the brackets, even gave them names, I could not find where to put it.

I stuck an extra bracket at the end of main() It, the bastard, was happy.

But nothing worked, not even InitLCD, first thing in main().

Raisonance doesn't seem to have much of a back up system, and it cost me ( on my 60'th birthday) about 5 hours.

Any hints /tips/ goto keil, do not pass go, on the missing bracket syndrome

"up hill in both directions"

martin

Reply to
Martin Griffith
Loading thread data ...

Well, you're probably missing a '}'. :)

If you're using any decent programming editor, it should be pretty obvious where to put it, since the indentation level won't "look right" somewhere.

Alternatively, run the program through indent or astyle and look at the output to see where the indentation isn't right.

I don't see how you expect the compiler to know where the missing bracket belongs.

I don't get it: what do you mean by "a back up system"?

I don't see how it's the compiler's fault.

--
Grant Edwards                   grante             Yow! The entire CHINESE
                                  at               WOMEN'S VOLLEYBALL TEAM all
                               visi.com            share ONE personality --
                                                   and have since BIRTH!!
Reply to
Grant Edwards

I'm just using the standard Raisonance kit, I don't know how to patch in a descent editor. I've got stuff like PN2, but there seems to be little advice on how to stuff it into my compiler

My 1996 PCB design package has 4 undo files levels, *.bak1,*.bak2 etc, all the raisonance stuff is have a single .bak file

Quite agree, it's my fault, just wondering the best way to improve my programming knowledge, the help files are comprehensive, but uninformative

martin

Reply to
Martin Griffith

It sounds like you need a real editor and a revision control system. There are many to choose from (I'm an emacs+svn guy).

Using a real editor will help lots. One of the reasons that IDEs generally suck is that the editor sucks. The rest of the "features" in IDEs are usually mediocre at best, and the documentation is usually useless.

--
Grant Edwards                   grante             Yow!  I'm thinking about
                                  at               DIGITAL READ-OUT systems
                               visi.com            and computer-generated
                                                   IMAGE FORMATIONS...
Reply to
Grant Edwards

It is hiding in a comment?

--
ArarghMail803 at [drop the 'http://www.' from ->] http://www.arargh.com
BCET Basic Compiler Page: http://www.arargh.com/basic/index.html

To reply by email, remove the extra stuff from the reply address.
Reply to
ArarghMail803NOSPAM

Well young man, go here:

formatting link

and download pclint. It will find where your problem lies.

Oh, and belated birthday greetings. You do realise that 60 is the new

40 don't you.

Oh, and just in case dementia is setting in already, there's one other thing. You have to install and run the pclint as well as downloading it.

;-)

--
John B
Reply to
John B

... snip ...

That's 64, not 60. Unfortunately it is hard to pass off the years between 74 and 80.

Are you claiming pclint is now freely downloadable?

--
 [mail]: Chuck F (cbfalconer at maineline dot net) 
 [page]: 
            Try the download section.
Reply to
CBFalconer

The missing brace can hide in one of the header files.

One technique is to binary search for the point where adding the extra brace fixes things. If it fixes it at the end of main(), try moving it nearer the beginning of the source file (keeping it outside other definitions, like routines, structures, or initialization lists). At some point you'll go too far and you'll get the opposite message ("unexpected left brace") and you'll know the problem is below that point.

If you discover that the problem is fixed by putting a brace just after an #include (and not when its on the prior line), the problem will be in the include.

Reply to
robertwessel2

Arghhh -- the Evil -- it burns!

Sorry, I'm a vi+rcs guy and there hasn't been enough emacs bashing on here lately. '-)

Yup. Getting really familiar with one, ideally cross-platform, editor is a Good Thing.

I like the way that Imagecraft handles the "problem" in their IDE, by allowing the user to select and use their own favorite editor instead of the IDE's built-in one. It installs with hooks for a dozen well-known (and not so) programmer's editors (including EMACS!) plus a spot to define a new one if none of the others match.

The downside is that features like code completion may be missing, but there's the real upside of continuing to use one's own finger-macros.

Back at the OP: might give "indent" a try if the IDE doesn't include a code reformat option.

--
Rich Webb     Norfolk, VA
Reply to
Rich Webb

There is a free (GPL) lint tool available at

formatting link
including a Windows binary for the 3.1.1 release.

--
Rich Webb     Norfolk, VA
Reply to
Rich Webb

... snip ...

I have that. I was wondering about pclint, which is better.

--
 [mail]: Chuck F (cbfalconer at maineline dot net) 
 [page]: 
            Try the download section.
Reply to
CBFalconer

Unless, the compiler is shockingly bad it will be using simple text files. You can just edit them outside of the IDE and use them in the IDE. Some IDE's even detect files that change while they are loaded.

Even shockingly bad IDEs often allow exporting and importing text files which you can then edit. I've done this with PLC IDEs.

If you are running Windows you might take a look at Notepad++. Not high end but easy enough to start with.

Longer term, I strongly recommend PC-Lint (and turn the errors up until they are slightly painful). It's feedback will help you learn good habits quickly. Don't let a warning pass without understanding its source.

Not as quick as getting even a halfways decent editor but take a look at a version control system. When I'm working on a project any version that actually compiles gets archived.

Robert

--
Posted via a free Usenet account from http://www.teranews.com
Reply to
Robert Adsett

Too bad it's so expensive for Linux users. :(

--
Grant
Reply to
Grant Edwards

I spent a few days battling with splint, and never got it to do anything useful.

In order to elimiate warnings about code like this:

unsigned uint8_t b; b = 5;

You had to turn off warnings for code like this:

unsigned uint8_t b; b = 12345;

After asking about this and several other significant problems on the splint mailing list I was told that splint is intended as a research project and not as something that's meant to be useful for checking real-world source code.

At that point, I gave up on split.

--
Grant
Reply to
Grant Edwards

Oops. Disregard the "unsigned" in the above example.

--
Grant
Reply to
Grant Edwards

A serious impediment to switching for me.

Robert

--
Posted via a free Usenet account from http://www.teranews.com
Reply to
Robert Adsett

I agree they need a cheaper Linux version - but I think the Win32 console version will work with Wine on Linux, check the Gimpel discussion list.

Reply to
Marco

No thanks. I'm not willing to jump through hoops for the sake of rewarding Gimpel's antiquated pricing policies. If they want me as a customer, they're going to have to price the Linux version lower.

--
Grant Edwards                   grante             Yow!  .. hubub, hubub,
                                  at               HUBUB, hubub, hubub, hubub,
                               visi.com            HUBUB, hubub, hubub, hubub.
Reply to
Grant Edwards

Would that be transparent to make? IE could make call it and get the error codes returned (with the messages piped accordingly of course)?

Robert

--
Posted via a free Usenet account from http://www.teranews.com
Reply to
Robert Adsett

Thanks for that, downloaded it and will play with it soon. Does that mean I'll have double dementia?

martin

Reply to
Martin Griffith

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.