NO

Author Topic: warning #2228: Unable to expand function 'StringCbPrintfW' inline.  (Read 4044 times)

Snowman

  • Guest
Hello forum. I am using Pelles C version 8.00.60.
I am compiling the code below with speed optimizations and Level 2 warnings.

Code: [Select]
#define UNICODE
#define _UNICODE

#include <windows.h>
#include <tchar.h>
#include <strsafe.h>

int _tmain(void)
{
    TCHAR test[200];

    (void)StringCbPrintf(test, sizeof test, _T("Hello Windows API!"));
    return 0;
}

The warning in this thread's title is given if I use StringCbPrintf() but not if I use _sntprintf():
Code: [Select]
main.c(14): warning #2228: Unable to expand function 'StringCbPrintfW' inline.
My questions are:
  • What can I do about this warning other than disable it?
  • Should I use _sntprintf() instead, just for the sake of being inlined?
  • Will this be fixed in future versions of Pelles C?

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: warning #2228: Unable to expand function 'StringCbPrintfW' inline.
« Reply #1 on: June 26, 2015, 03:17:17 PM »
 
  • Do nothing. This warning is only informative that the compiler is unable to inline the function. The function StringCbPrintfW is declared __inline, that is a suggestion to compiler and not an imposition to inline it (like could be __forceinline).
  • _sntprintf is not implemented in PellesC. Using it you'll get only an error message suggesting you to use StringCbPrintf()
  • There is not so much to fix here. Maybe a better code generator in future versions will do it...
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

ElectroDoc

  • Guest
Re: warning #2228: Unable to expand function 'StringCbPrintfW' inline.
« Reply #2 on: July 01, 2015, 02:56:32 AM »
You can simply change the warning level to 1 and see if this will 'hide' that warning.

Offline jj2007

  • Member
  • *
  • Posts: 536
Re: warning #2228: Unable to expand function 'StringCbPrintfW' inline.
« Reply #3 on: July 01, 2015, 08:39:51 AM »
You can simply change the warning level to 1 and see if this will 'hide' that warning.

Better:
Code: [Select]
#pragma warn(disable:2228)
#include <strsafe.h>