Raised This Month: $51 Target: $400
 12% 

[Compiler BUG] enums and floats


  
 
 
Thread Tools Display Modes
Author Message
karlos
Veteran Member
Join Date: Apr 2004
Location: Germany/Poland
Old 07-13-2006 , 20:15   [Compiler BUG] enums and floats
#1

here is a little test plugin
Code:
#include <amxmodx>

enum data
{
    Float:myfloat
}

new dat[data]

public plugin_init( )
{
    register_plugin("test_enum_floats", "0.1", "White Panther")
    
    server_print("myfloat %f", dat[myfloat])
    dat[myfloat] = 2.0
    server_print("myfloat %f", dat[myfloat])
    dat[myfloat] += 2.0
    server_print("myfloat %f", dat[myfloat])
    dat[myfloat] = 6.0
    server_print("myfloat %f", dat[myfloat])
}
i get these warnings
Code:
test.sma(15 -- 16) : warning 213: tag mismatch
test.sma(19 -- 20) : warning 213: tag mismatch
so each assignment ( = ) is a tag mismatch
where additions ( += ) work fine

Code:
    dat[myfloat] = _:2.0
    server_print("myfloat %f", dat[myfloat])
    dat[myfloat] += 2.0
    server_print("myfloat %f", dat[myfloat])
    dat[myfloat] = _:6.0
this does solve the warnings but it should work without it too

using this plugin( same as above only adjusted ), tested with SMALL compiler v2.7.3 and PAWN compiler v3.0.3367 + v3.2.3599 and there are no tag mismatches
Code:
#include <float>

enum data
{
	Float:myfloat,
}

new dat[data]

main( )
{
	printf("myfloat %f\n", dat[myfloat])
	dat[myfloat] = 2.0
	printf("myfloat %f\n", float:dat[myfloat])
	dat[myfloat] += 2.0
	printf("myfloat %f\n", dat[myfloat])
	dat[myfloat] = 6.0
	server_print("myfloat %f", dat[myfloat])
}
PS:
plugins do work fine with these tag mismatches
it is only disturbing, especially when you want to release a plugin using this kind of code
__________________
alias White Panther
karlos is offline
BAILOPAN
Join Date: Jan 2004
Old 07-13-2006 , 23:41   Re: [Compiler BUG] enums and floats
#2

as said on IRC, this is ack'd as a bug. I think this is caused by a hand-coded response fix to an earlier tag mismatch bug.

it won't be fixed anytime soon, but when we do get a fix, I'll update and lock this topic.
__________________
egg
BAILOPAN is offline
 



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 -4. The time now is 01:38.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode