Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Weird lcc-win32 behaviour

Reply
Thread Tools

Weird lcc-win32 behaviour

 
 
Keith Thompson
Guest
Posts: n/a
 
      12-12-2005
jacob navia <(E-Mail Removed)> writes:
> Mark McIntyre a écrit :

[...]
>> Unless you have a very new compiler, you can't declare variables
>> after
>> executable statements. I don't know if lcc-win32 suupports this/

>
> This is standard C. lcc-win32 supports it.
> Declaring variables anywhere is supported since at least 2 years now.


Yes, this is standard C. The current C standard is C99.
Unfortunately, the current standard is not (yet?) as widely supported
as the previous one, C90. Mixing declarations and statements can
still cause portability problems if you care about platforms that
don't have C99 compilers (or at least C90 compilers that support
mixing declarations and statements as an extension).

--
Keith Thompson (The_Other_Keith) http://www.velocityreviews.com/forums/(E-Mail Removed) <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
 
Reply With Quote
 
 
 
 
jacob navia
Guest
Posts: n/a
 
      12-12-2005
Keith Thompson a écrit :
> jacob navia <(E-Mail Removed)> writes:
>
>>Mark McIntyre a écrit :

>
> [...]
>
>>>Unless you have a very new compiler, you can't declare variables
>>>after
>>>executable statements. I don't know if lcc-win32 suupports this/

>>
>>This is standard C. lcc-win32 supports it.
>>Declaring variables anywhere is supported since at least 2 years now.

>
>
> Yes, this is standard C. The current C standard is C99.
> Unfortunately, the current standard is not (yet?) as widely supported
> as the previous one, C90. Mixing declarations and statements can
> still cause portability problems if you care about platforms that
> don't have C99 compilers (or at least C90 compilers that support
> mixing declarations and statements as an extension).
>


I know Keith, but you will
NOT
have any of those problems using lcc-win32 !!! (

I care about standards and implemented that quite a
while ago.

jacob
 
Reply With Quote
 
 
 
 
Mark McIntyre
Guest
Posts: n/a
 
      12-12-2005
On Mon, 12 Dec 2005 12:26:37 +0100, in comp.lang.c , jacob navia
<(E-Mail Removed)> wrote:

>Mark McIntyre a écrit :
>> Unless you have a very new compiler, you can't declare variables after
>> executable statements. I don't know if lcc-win32 suupports this/

>
>This is standard C. lcc-win32 supports it.
>Declaring variables anywhere is supported since at least 2 years now.


Fair enough. Still a risky habit to get into, if one ever uses a
different compiler.

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
 
Reply With Quote
 
Keith Thompson
Guest
Posts: n/a
 
      12-12-2005
jacob navia <(E-Mail Removed)> writes:
> Keith Thompson a écrit :
>> jacob navia <(E-Mail Removed)> writes:
>>
>>>Mark McIntyre a écrit :

>> [...]
>>
>>>>Unless you have a very new compiler, you can't declare variables
>>>>after
>>>>executable statements. I don't know if lcc-win32 suupports this/
>>>
>>>This is standard C. lcc-win32 supports it.
>>>Declaring variables anywhere is supported since at least 2 years now.

>> Yes, this is standard C. The current C standard is C99.
>> Unfortunately, the current standard is not (yet?) as widely supported
>> as the previous one, C90. Mixing declarations and statements can
>> still cause portability problems if you care about platforms that
>> don't have C99 compilers (or at least C90 compilers that support
>> mixing declarations and statements as an extension).

>
> I know Keith, but you will
> NOT
> have any of those problems using lcc-win32 !!! (


Yes, jacob, we know that.

I do have one major problem with lcc-win32: it only works in a single
environment. Others may find it useful in spite of that. I don't.

> I care about standards and implemented that quite a
> while ago.


Great, but in the real world many of us still have to deal with
pre-C99 implementations, and it would be foolish to ignore that fact.

Fortunately that particular C99 feature, though it's nice to have, is
not essential. It's easy enough to restructure your code so that all
the declarations precede all the statements in each block. The
resulting code (assuming no other problems) is legal in both C90 and
C99.

--
Keith Thompson (The_Other_Keith) (E-Mail Removed) <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
 
Reply With Quote
 
Vittorio
Guest
Posts: n/a
 
      12-13-2005
Thanks for the complete re-editing of my original program.
You're right: I must learn to use more functions in programming and
master many other techniques. But you know, programming isn't only a
science is mainly an art to be learnt step by step from other artists!
Thank you indeed
Vittorio

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
debugger behaviour different to execution behaviour Andy Chambers Java 1 05-14-2007 09:51 AM
Weird TextBox behaviour fd123456 ASP .Net 1 12-23-2004 04:37 PM
weird user control behaviour - please help! =?Utf-8?B?RGFuIE5hc2g=?= ASP .Net 0 11-02-2004 02:42 PM
Weird behaviour of SetAuthCookie, bug? Strange Cat ASP .Net 1 03-01-2004 04:10 PM
FormsAuthentication - Weird Behaviour dotCore ASP .Net 1 02-09-2004 03:52 AM



Advertisments