English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 06 October 2009, 02:29   #1
andreas
Zone Friend
 
Join Date: Jun 2001
Location: Germany
Age: 50
Posts: 5,857
Send a message via ICQ to andreas Send a message via AIM to andreas
Arrow xDMS vs. GNU99

Hi,

I'm planning to do a heavily-stripped-down version from xDMS to get some DMS support into ADFCHK, but I'm trying to compile with -std=gnu99.
This already helped me to fix lots of dirty stuff which would normally get compiled as if it was the world's most perfect code. (orphaned extern declarations, and whatnot!!)

Though now some ancient code in xDMS ( http://aminet.net/util/arc/xDMS.lha ) produces the following warning:

Code:
xdms\u_deep.c: In function 'DecodeChar':
xdms\u_deep.c:114: warning: 'update' is static but used in inline function 'DecodeChar' which is not static
xdms\u_heavy.c: In function 'decode_c':
xdms\u_heavy.c:80: warning: 'c_table' is static but used in inline function 'decode_c' which is not static
xdms\u_heavy.c:82: warning: 'c_len' is static but used in inline function 'decode_c' which is not static
xdms\u_heavy.c:92: warning: 'c_len' is static but used in inline function 'decode_c' which is not static
xdms\u_heavy.c: In function 'decode_p':
xdms\u_heavy.c:102: warning: 'pt_table' is static but used in inline function 'decode_p' which is not static
xdms\u_heavy.c:103: warning: 'np' is static but used in inline function 'decode_p' which is not static
xdms\u_heavy.c:104: warning: 'pt_len' is static but used in inline function 'decode_p' which is not static
...
xdms\u_heavy.c:122: warning: 'lastlen' is static but used in inline function 'decode_p' which is not static
xdms\u_heavy.c:125: warning: 'lastlen' is static but used in inline function 'decode_p' which is not static
Changing from

INLINE USHORT decode_c(void);
INLINE USHORT decode_p(void);

to

static INLINE USHORT decode_c(void);
static INLINE USHORT decode_p(void);

gets rid of the warning...BUT...
can I safely do this without getting ugly side-effects?

To my knowledge, side-effects could only occur in this case if there was another implementation of decode_c()/decode_p() in some other file (since static also means that it's allowed to use the same function name in 2 different files, since the functions are only known locally to that one translation unit.

Last edited by andreas; 09 October 2009 at 03:32.
andreas is offline  
Old 06 October 2009, 15:47   #2
TheDarkCoder
Registered User
 
Join Date: Dec 2007
Location: Dark Kingdom
Posts: 213
Hi Andreas

I have also read your post on comp.lang.c

As others told you in that thread, the meaning of "inline" is different between C99 and gnu99

I don't know the gnu99 extensions well (never used them) but in C99 it is a constraint violation if a inline function with external linkage does contain a reference to an identifier with internal linkage.

it seems to me that that's exactly your case. I am not sure since "static" mean either no or internal linkage, depending on the scope. If the various "update", "c_table", etc are file scope identifiers, then that's your case.

Anyway, I think that your problem is that those sources were made before C99 standirdized the inline keyword. So they depend on implementation defined behavior, i.e. the compiler used by the original developer.

I agree with your knowledge regarding "static functions", i.e. functions with internal linkage.
TheDarkCoder is offline  
Old 06 October 2009, 17:26   #3
andreas
Zone Friend
 
Join Date: Jun 2001
Location: Germany
Age: 50
Posts: 5,857
Send a message via ICQ to andreas Send a message via AIM to andreas
Quote:
Originally Posted by TheDarkCoder View Post
Hi Andreas

I have also read your post on comp.lang.c
Haha, hell yeah the Internet is just a village

But please note that the questions I asked on CLC and here are merely related; they are NOT identical. The one you read on the group was about inline/extern inline binding and no single thing about static. (deliberately, since it would a bit annoying others to mix two questions into one)

That means, pretend as if you didn't read the usenet post so that you don't mix them by accident
andreas is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
xdms 1.3.2 Qube Coders. General 43 08 May 2013 11:02
Help With xDMS Aleph Five support.Apps 5 23 May 2010 12:43
Please avoid xDMS with files which contain headers andreas project.TOSEC (amiga only) 5 31 March 2006 16:47
Who can program an xDMS clone with logging ability? andreas Coders. General 10 08 October 2003 18:23

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

Forum Jump


All times are GMT +2. The time now is 15:41.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.08806 seconds with 13 queries