NO

Author Topic: small bug in 'Convert to -> Formatted C code'  (Read 2298 times)

Romashka

  • Guest
small bug in 'Convert to -> Formatted C code'
« on: May 02, 2009, 01:37:16 PM »
'Convert to -> Formatted C' code does not correctly formats some declarations:

Code: [Select]
void foobar(custom_t *foo, char *bar);becomes
Code: [Select]
void foobar(custom_t * foo, char *bar);here position of * is different for custom types comparing to standard C types.

EDIT: forgot to add that this bug exists in both 5.00.1 and 6.00 RC1.

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: small bug in 'Convert to -> Formatted C code'
« Reply #1 on: May 02, 2009, 02:19:06 PM »
I suspect the problem here is that the formatter thinks it's looking at a multiplication. It's easy to recognize the standard types (char, double, ...) - it's much, much, harder to recognize "custom" type definitions (in code formatter, browse info manager, etc - none of them is a compiler, with a full context).

I will look at it, but I may not do much about it (a small bug compared to the very large job of fixing it, I think).
 
/Pelle

Romashka

  • Guest
Re: small bug in 'Convert to -> Formatted C code'
« Reply #2 on: May 02, 2009, 02:49:28 PM »
I think it is safe to assume that there cannot be any multiplications in funtion definition.
Of course there can probbly be other cases where custom types can be confused with multiplication.
I agree that it's not worth to fix such small issue if it's not easy to do so.

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: small bug in 'Convert to -> Formatted C code'
« Reply #3 on: May 02, 2009, 03:33:12 PM »
I strongly suspect the problem is to understand that a (small) set of tokens *is* a function definition - and not, say, an expression...
/Pelle