EmbeddedRelated.com
Forums

Scanf library from shdesigns dont compile under Dynamic C V 10.21

Started by promolinux April 15, 2008
Scott, im migrating my project code from dynamic C 9.52 with cores
RCM3000 to dynamic C 10.21 with cores RCM4XXX.

Im using your sscanf.lib library. The new compiler complains:

line 217 : ERROR SSCANF.LIB : Invalid expression - need lvalue.

The code is:
while ((isspace(*line)==0) && (*line != 0))
*(((char*)args[argcnt])++)=*line++; <--- ofending line

Any idea?

TIA

Donald.
promolinux wrote:
> Scott, im migrating my project code from dynamic C 9.52 with cores
> RCM3000 to dynamic C 10.21 with cores RCM4XXX.
>
> Im using your sscanf.lib library. The new compiler complains:
>
> line 217 : ERROR SSCANF.LIB : Invalid expression - need lvalue.
>
> The code is:
> while ((isspace(*line)==0) && (*line != 0))
> *(((char*)args[argcnt])++)=*line++; <--- ofending line
>
> Any idea?
>
> TIA
>
> Donald.
>
Jeez, they still don't have a sscanf?

Download the latest, it will compile.

This is another bug in 10.x ;(

--
------
| Scott G. Henion| s...@shdesigns.org |
| Consultant | Stone Mountain, GA |
| SHDesigns http://www.shdesigns.org |
------
Rabbit libs: http://www.shdesigns.org/rabbit/
today's fortune
A clash of doctrine is not a disaster -- it is an opportunity.
--- In r..., Scott Henion wrote:

> Jeez, they still don't have a sscanf?

Nope.

>
> Download the latest, it will compile.

Im using the latest file, downloaded from your website, creation date
8/06/2004. This is the latest?

> This is another bug in 10.x ;(

Seems like, yes.

TIA.

Donald .

promolinux wrote:
>
>> Download the latest, it will compile.
>>
>
> Im using the latest file, downloaded from your website, creation date
> 8/06/2004. This is the latest?
>
I uploaded a new one today as soon as you posted the message.

--
------
| Scott G. Henion| s...@shdesigns.org |
| Consultant | Stone Mountain, GA |
| SHDesigns http://www.shdesigns.org |
------
Rabbit libs: http://www.shdesigns.org/rabbit/
today's fortune
When a girl marries she exchanges the attentions of many men for the
inattentions of one.
-- Helen Rowland
--- In r..., Scott Henion wrote:

> I uploaded a new one today as soon as you posted the message.

Sorry, my mistake.

It compile now, thanks a lot.

Donald.
--- In r..., Scott Henion wrote:
> > *(((char*)args[argcnt])++)=*line++; <--- ofending line
>
> Download the latest, it will compile.

What did you have to change (that you shouldn't have had to change)?
That was perfectly valid C code as is (was).

Bill
Bill_CT wrote:
> --- In r..., Scott Henion wrote:
>
>>> *(((char*)args[argcnt])++)=*line++; <--- ofending line
>>>
>> Download the latest, it will compile.
>>
>
> What did you have to change (that you shouldn't have had to change)?
> That was perfectly valid C code as is (was).
>
>

Was:

*(((char*)args[argcnt])++)=*line++;

Changed to:

char * s;
s=(char *)args[argcnt];
*s++=*line++;

It was valid code. Ugly, but valid.

I bet it was this part:

((char*)args[argcnt])++

basically (x)++ where x is not just a simple scalor but an array and a cast must be a bear to handle in the compiler.

It is ugly code I wrote for a pre-ANSI compiler back in 1988. Never thought I would reuse the code as it is so outdated. Today, I'd use ANSI variable arg list macros, but this is DC any you have to use 20 year old practices. ;)

--
------
| Scott G. Henion| s...@shdesigns.org |
| Consultant | Stone Mountain, GA |
| SHDesigns http://www.shdesigns.org |
------
Rabbit libs: http://www.shdesigns.org/rabbit/
today's fortune
The point is that descriptive writing is very rarely entirely accurate and
during the reign of Olaf Quimby II as Patrician of Ankh some legislation
was passed in a determined attempt to put a stop to this sort of thing and
introduce some honesty into reporting. Thus, if a legend said of a notable
here that "all men spoke of his prowess" any bard who valued his life would
add hastily "except for a couple of people in his home village who thought
he was a liar, and quite a lot of other people who had never really heard
of him."
-- (Terry Pratchett, The Light Fantastic)
--- In r..., Scott Henion wrote:
> It was valid code. Ugly, but valid.
>

Scot, i have bad news, the new version dont work as expected under
version 9.21 (i cannot test rigth now in version 10.xx, because i dont
will use RCM4XXX due to several reasons).

Example:

That line of code:

sscanf(datopc,"%s %s %s",param1,param2,param3);

with datopc = 'GET CLOCK'

in previous version returns:

param1 = 'GET'
param2 = 'CLOCK'

in actual version returns:

param1 = 'GET008(moregarbage)'
param2 = 'CLOCK0(moregarbage)'

I just come back to previous version (i love svn, do you?)

Just wanna tell you, im sure you will find where is the problem.

Best regards.

Donald.