To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.nqcOpen lugnet.robotics.rcx.nqc in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / NQC / 1411
1410  |  1412
Subject: 
Re: NQC and BricxCC problem
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Sun, 5 May 2002 20:17:42 GMT
Viewed: 
4177 times
  
John,

The crash is because NQC is trying to print out an error message but
doesn't have legitimate information about the lexical location (file,
line number, etc) of where the error occurred.  The error itself is from
the "#pragma init" line - initialization functions cannot have
arguments.  I added a fix to the NQC source so that it will correctly
locate the error in this case.  I don't think it's important enough to
warrant a release at the moment.

I would encourage programmers not to use "#pragma init", and instead
simply call their initialization functions at the start of main(),
supplying whatever parameters they wish to the function.

Dave


In article <Gvn5uD.IG@lugnet.com>, "John Hansen" <JohnBinder@aol.com>
wrote:

Dave (or anyone else who might have an idea),

I'm trying to figure out a problem that a user reported regarding BricxCC
and its interaction with NQC.  (I've only tested it against the latest
release of both BricxCC and NQC.)  When attempting to compile a program
containing a #pragma init statement and the target is set to RCX2 on some
machines (not on my machine at home running W2K Pro but on my machine at
work - a Dell - running W2K Pro) it dies at the CreateProcess call that
launches NQC with an unhandled exception error.

If I run NQC in a DOS box it appears to function normally.   But if the user
has a #pragma init statement that names a function which takes parameters
(which is, I believe, a programming error) the compiler outputs an odd error
message:

# Error: wrong number of parameters
File "<cmdline>" ; line 1
# 2
#
#----------------------------------------------------------
# 1 error during compilation

And in this case, on some machines, I get that unhandled exception error
when I step over the CreateProcess call in BricxCC where it launches NQC.

Normally the error messages all show the name of the file NQC was attempting
to compile, such as "c:\test.nqc" or something like that.

Here's a sample program that crashes NQC if I launch it via BricxCC (and
I've now managed to get it to crash on my development PC at home):

#pragma init Testing

task main()
{
  int a = 0;
  int b = 0;
  int c = 0;
  int d = 0;
  int e = 0;
  int f = 0;
}


void Testing(int x, int a)
{
  int z = 2;
  int p = 1;
}

If I remove the "int f = 0;" line it does not crash.  If I comment out the
#pragma it doesn't crash.  If I replace the "(int x, int a)" with "()" it
doesn't crash.

Any ideas?

Thanks,

John Hansen
http://members.aol.com/~johnbinder/bricxcc.htm



Message is in Reply To:
  NQC and BricxCC problem
 
Dave (or anyone else who might have an idea), I'm trying to figure out a problem that a user reported regarding BricxCC and its interaction with NQC. (I've only tested it against the latest release of both BricxCC and NQC.) When attempting to (...) (23 years ago, 5-May-02, to lugnet.robotics.rcx.nqc)

2 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR