Curly bracket question

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
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

Re: Curly bracket question
Quoted text here. Click to load it

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

Quoted text here. Click to load it

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.

Quoted text here. Click to load it

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

Quoted text here. Click to load it

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

Quoted text here. Click to load it

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

--
Grant Edwards                   grante             Yow! The entire CHINESE
                                  at               WOMEN'S VOLLEYBALL TEAM all
We've slightly trimmed the long signature. Click to see the full one.
Re: Curly bracket question
On Fri, 28 Mar 2008 21:51:42 -0000, in comp.arch.embedded Grant

Quoted text here. Click to load it

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
Quoted text here. Click to load it

My 1996 PCB design package has 4 undo files levels, *.bak1,*.bak2 etc,
all the raisonance stuff is have a single  .bak file
Quoted text here. Click to load it

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



martin

Re: Curly bracket question

Quoted text here. Click to load it

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).

Quoted text here. Click to load it

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
We've slightly trimmed the long signature. Click to see the full one.
Re: Curly bracket question

Quoted text here. Click to load it

Arghhh -- the Evil -- it burns!

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

Quoted text here. Click to load it

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

Re: Curly bracket question
says...
Quoted text here. Click to load it

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.
 
Quoted text here. Click to load it

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

--

Re: Curly bracket question

Quoted text here. Click to load it

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

--
Grant


Re: Curly bracket question
Quoted text here. Click to load it

A serious impediment to switching for me.

Robert

--

Re: Curly bracket question
Quoted text here. Click to load it

  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.

Re: Curly bracket question
Quoted text here. Click to load it

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,
We've slightly trimmed the long signature. Click to see the full one.
Re: Curly bracket question
In article <1f2e6e09-2cbe-4502-94d7-
snipped-for-privacy@a22g2000hsc.googlegroups.com>, Marco says...
Quoted text here. Click to load it

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

--

Re: Curly bracket question
On Fri, 28 Mar 2008 22:20:31 +0100, Martin Griffith

Quoted text here. Click to load it

It is hiding in a comment?
<snip>
--
ArarghMail803 at [drop the 'http://www.' from ->] http://www.arargh.com
BCET Basic Compiler Page: http://www.arargh.com/basic/index.html

We've slightly trimmed the long signature. Click to see the full one.
Re: Curly bracket question

Quoted text here. Click to load it


Well young man, go here:

http://www.gimpel.com /

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

Re: Curly bracket question
Quoted text here. Click to load it
... snip ...
Quoted text here. Click to load it

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]: <http://cbfalconer.home.att.net
We've slightly trimmed the long signature. Click to see the full one.
Re: Curly bracket question

Quoted text here. Click to load it

There is a free (GPL) lint tool available at http://www.splint.org /
including a Windows binary for the 3.1.1 release.

--
Rich Webb     Norfolk, VA

Re: Curly bracket question
Quoted text here. Click to load it
... snip ...
Quoted text here. Click to load it

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

--
 [mail]: Chuck F (cbfalconer at maineline dot net)
 [page]: <http://cbfalconer.home.att.net
We've slightly trimmed the long signature. Click to see the full one.
Re: Curly bracket question

Quoted text here. Click to load it

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


Re: Curly bracket question

Quoted text here. Click to load it

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

--
Grant


Re: Curly bracket question
On 28 Mar 2008 23:37:33 GMT, in comp.arch.embedded "John B"

Quoted text here. Click to load it
Thanks for that, downloaded it and will play with it soon.
Does that mean I'll have double dementia?


martin

Re: Curly bracket question
Quoted text here. Click to load it


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.


Site Timeline