Re: Jammer-Thread
Verfasst: 22.10.2011, 14:54
Schonmal auf anderer Hardware getestet?
Code: Alles auswählen
var = 3;
switch(var)
{
case 0:
foo();
break;
case 1:
bar();
break;
case 2:
foobar();
break;
case 3:
break;
default:
break;
}
Sowas wie warning-level gibts im gcc/clang ja nicht, man kann eben einen Haufen warnings einzeln an- und abschalten und natürlich alles an und dann treat warnings as errors, wovon ich unter Xcode stark abrate (da das nämlich auch so Sachen, wie your Provising profile is about to expire" als Warnings anzeigt, obwohl man es erst verlängern kann, wenn es tatsächlich ausgelaufen ist...).Chromanoid hat geschrieben:ObjC ist voll von solchen Späßen. Sicher das man nicht irgendwo die höchste Warnstufe einstellen kann und das dann angezeigt wird?
Wieso auch? Java wird nicht besser wenn man dabei auch noch hinguckt. *scnr*Als Java Freund ist man es ja gar nicht gewöhnt so genau hinzuschauen.
Das hat aber auch mich, der aus dem Bereich C/C++ kommt, anfangs irritiert, dass ich in objC zur Kompilierzeit jede Methode auf jeder Klasse aufrufen kann und erst zur Laufzeit geprüft wird, ob die Klasse überhaupt eine Methode mit dem Namen und der Signatur kennt.Chromanoid hat geschrieben:ic ich glaube ich habe noch eine etwas ältere version gehabt. Als Java Freund ist man es ja gar nicht gewöhnt so genau hinzuschauen. Als ich damals an einem App entwickelt hab, habe ich also erst mal laufend irgendwelche unbekannten signale verschickt... Das war dann der Moment an dem ich begonnen habe Warnungen ernst zu nehmen :D.
Code: Alles auswählen
// Formatierte Stringausgabe in C:
// ascii string in formatierten ascii string Ausgabe:
printf("%s\n", "foo0"); // VS: ok, GCC: ok - wie erwartet
printf("%S\n", "foo1"); // VS: nicht ok, GCC: nicht ok - wie erwartet
printf("%hs\n", "foo2"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein hs
printf("%ls\n", "foo3"); // VS: nicht ok, GCC: nicht ok - wie erwartet
printf("%hS\n", "foo4"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein hS
printf("%lS\n", "foo5"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein lS
// Fazit -> ascii into ascii: nur %s funzt plattformunabhängig
// unicode string in formatierten ascii string Ausgabe:
printf("%s\n", L"foo6"); // VS: nicht ok, GCC: nicht ok - wie erwartet
printf("%S\n", L"foo7"); // VS: ok, GCC: ok - wie erwartet
printf("%hs\n", L"foo8"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein hs
printf("%ls\n", L"foo9"); // VS: ok, GCC: ok - wie erwartet
printf("%hS\n", L"foo10"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein Hs
printf("%lS\n", L"foo11"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein lS
// Fazit -> unicode into ascii: %S und %ls funzen plattformunabhängig
// ascii string in formatierten unicode string Ausgabe:
wprintf(L"%s\n", "foo12"); // VS: nicht ok, GCC: ok - os-abhängiges Verhalten
wprintf(L"%S\n", "foo13"); // VS: ok, GCC: nicht ok - os-abhängiges Verhalten
wprintf(L"%hs\n", "foo14"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein hs
wprintf(L"%ls\n", "foo15"); // VS: nicht ok, GCC: nicht ok - wie erwartet
wprintf(L"%hS\n", "foo16"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein hS
wprintf(L"%lS\n", "foo17"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein lS
// Fazit -> ascii into unicode: überhaupt nichts funzt plattformunabhängig
// unicode string in formatierten unicode string Ausgabe:
wprintf(L"%s\n", L"foo18"); // VS: ok, GCC: nicht ok - os-abhängiges Verhalten
wprintf(L"%S\n", L"foo19"); // VS: nicht ok, GCC: ok - os-abhängiges Verhalten
wprintf(L"%hs\n", L"foo20"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein hs
wprintf(L"%ls\n", L"foo21"); // VS: ok, GCC: ok - wie erwartet
wprintf(L"%hS\n", L"foo22"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein hS
wprintf(L"%lS\n", L"foo23"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein lS
// Fazit -> unicode into unicode: nur %ls funzt plattformunabhängig
That's the reason why you should use utf-8kaiserludi hat geschrieben:Kopf -> WandCode: Alles auswählen
// Formatierte Stringausgabe in C: // ascii string in formatierten ascii string Ausgabe: printf("%s\n", "foo0"); // VS: ok, GCC: ok - wie erwartet printf("%S\n", "foo1"); // VS: nicht ok, GCC: nicht ok - wie erwartet printf("%hs\n", "foo2"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein hs printf("%ls\n", "foo3"); // VS: nicht ok, GCC: nicht ok - wie erwartet printf("%hS\n", "foo4"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein hS printf("%lS\n", "foo5"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein lS // Fazit -> ascii into ascii: nur %s funzt plattformunabhängig // unicode string in formatierten ascii string Ausgabe: printf("%s\n", L"foo6"); // VS: nicht ok, GCC: nicht ok - wie erwartet printf("%S\n", L"foo7"); // VS: ok, GCC: ok - wie erwartet printf("%hs\n", L"foo8"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein hs printf("%ls\n", L"foo9"); // VS: ok, GCC: ok - wie erwartet printf("%hS\n", L"foo10"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein Hs printf("%lS\n", L"foo11"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein lS // Fazit -> unicode into ascii: %S und %ls funzen plattformunabhängig // ascii string in formatierten unicode string Ausgabe: wprintf(L"%s\n", "foo12"); // VS: nicht ok, GCC: ok - os-abhängiges Verhalten wprintf(L"%S\n", "foo13"); // VS: ok, GCC: nicht ok - os-abhängiges Verhalten wprintf(L"%hs\n", "foo14"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein hs wprintf(L"%ls\n", "foo15"); // VS: nicht ok, GCC: nicht ok - wie erwartet wprintf(L"%hS\n", "foo16"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein hS wprintf(L"%lS\n", "foo17"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein lS // Fazit -> ascii into unicode: überhaupt nichts funzt plattformunabhängig // unicode string in formatierten unicode string Ausgabe: wprintf(L"%s\n", L"foo18"); // VS: ok, GCC: nicht ok - os-abhängiges Verhalten wprintf(L"%S\n", L"foo19"); // VS: nicht ok, GCC: ok - os-abhängiges Verhalten wprintf(L"%hs\n", L"foo20"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein hs wprintf(L"%ls\n", L"foo21"); // VS: ok, GCC: ok - wie erwartet wprintf(L"%hS\n", L"foo22"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein hS wprintf(L"%lS\n", L"foo23"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein lS // Fazit -> unicode into unicode: nur %ls funzt plattformunabhängig
Wenn die lösung so einfach wäre, aber dummerweise unterstützen wir auch Plattformen, auf denen UTF8-Support praktisch nicht vorhanden ist und man daher auf widestrings angewiesen ist, von sonstigen auch auf anderen Plattformen vorhandenen Nachteilen von utf8 in der API (Performance und Komplexität von Operationen auf dem String, wenn nicht alle Characters die gleiche Größe haben) mal ganz zu schweigen.antisteo hat geschrieben:That's the reason why you should use utf-8kaiserludi hat geschrieben:Kopf -> WandCode: Alles auswählen
// Formatierte Stringausgabe in C: // ascii string in formatierten ascii string Ausgabe: printf("%s\n", "foo0"); // VS: ok, GCC: ok - wie erwartet printf("%S\n", "foo1"); // VS: nicht ok, GCC: nicht ok - wie erwartet printf("%hs\n", "foo2"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein hs printf("%ls\n", "foo3"); // VS: nicht ok, GCC: nicht ok - wie erwartet printf("%hS\n", "foo4"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein hS printf("%lS\n", "foo5"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein lS // Fazit -> ascii into ascii: nur %s funzt plattformunabhängig // unicode string in formatierten ascii string Ausgabe: printf("%s\n", L"foo6"); // VS: nicht ok, GCC: nicht ok - wie erwartet printf("%S\n", L"foo7"); // VS: ok, GCC: ok - wie erwartet printf("%hs\n", L"foo8"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein hs printf("%ls\n", L"foo9"); // VS: ok, GCC: ok - wie erwartet printf("%hS\n", L"foo10"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein Hs printf("%lS\n", L"foo11"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein lS // Fazit -> unicode into ascii: %S und %ls funzen plattformunabhängig // ascii string in formatierten unicode string Ausgabe: wprintf(L"%s\n", "foo12"); // VS: nicht ok, GCC: ok - os-abhängiges Verhalten wprintf(L"%S\n", "foo13"); // VS: ok, GCC: nicht ok - os-abhängiges Verhalten wprintf(L"%hs\n", "foo14"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein hs wprintf(L"%ls\n", "foo15"); // VS: nicht ok, GCC: nicht ok - wie erwartet wprintf(L"%hS\n", "foo16"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein hS wprintf(L"%lS\n", "foo17"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein lS // Fazit -> ascii into unicode: überhaupt nichts funzt plattformunabhängig // unicode string in formatierten unicode string Ausgabe: wprintf(L"%s\n", L"foo18"); // VS: ok, GCC: nicht ok - os-abhängiges Verhalten wprintf(L"%S\n", L"foo19"); // VS: nicht ok, GCC: ok - os-abhängiges Verhalten wprintf(L"%hs\n", L"foo20"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein hs wprintf(L"%ls\n", L"foo21"); // VS: ok, GCC: ok - wie erwartet wprintf(L"%hS\n", L"foo22"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein hS wprintf(L"%lS\n", L"foo23"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein lS // Fazit -> unicode into unicode: nur %ls funzt plattformunabhängig
Dazu hat Lazarus dann die Funktion utf8towidestring ;) (oder ich glaub der castet sogar implizit)kaiserludi hat geschrieben:Wenn die lösung so einfach wäre, aber dummerweise unterstützen wir auch Plattformen, auf denen UTF8-Support praktisch nicht vorhanden ist und man daher auf widestrings angewiesen ist, von sonstigen auch auf anderen Plattformen vorhandenen Nachteilen von utf8 in der API (Performance und Komplexität von Operationen auf dem String, wenn nicht alle Characters die gleiche Größe haben) mal ganz zu schweigen.antisteo hat geschrieben:That's the reason why you should use utf-8kaiserludi hat geschrieben:Kopf -> WandCode: Alles auswählen
// Formatierte Stringausgabe in C: // ascii string in formatierten ascii string Ausgabe: printf("%s\n", "foo0"); // VS: ok, GCC: ok - wie erwartet printf("%S\n", "foo1"); // VS: nicht ok, GCC: nicht ok - wie erwartet printf("%hs\n", "foo2"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein hs printf("%ls\n", "foo3"); // VS: nicht ok, GCC: nicht ok - wie erwartet printf("%hS\n", "foo4"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein hS printf("%lS\n", "foo5"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein lS // Fazit -> ascii into ascii: nur %s funzt plattformunabhängig // unicode string in formatierten ascii string Ausgabe: printf("%s\n", L"foo6"); // VS: nicht ok, GCC: nicht ok - wie erwartet printf("%S\n", L"foo7"); // VS: ok, GCC: ok - wie erwartet printf("%hs\n", L"foo8"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein hs printf("%ls\n", L"foo9"); // VS: ok, GCC: ok - wie erwartet printf("%hS\n", L"foo10"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein Hs printf("%lS\n", L"foo11"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein lS // Fazit -> unicode into ascii: %S und %ls funzen plattformunabhängig // ascii string in formatierten unicode string Ausgabe: wprintf(L"%s\n", "foo12"); // VS: nicht ok, GCC: ok - os-abhängiges Verhalten wprintf(L"%S\n", "foo13"); // VS: ok, GCC: nicht ok - os-abhängiges Verhalten wprintf(L"%hs\n", "foo14"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein hs wprintf(L"%ls\n", "foo15"); // VS: nicht ok, GCC: nicht ok - wie erwartet wprintf(L"%hS\n", "foo16"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein hS wprintf(L"%lS\n", "foo17"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein lS // Fazit -> ascii into unicode: überhaupt nichts funzt plattformunabhängig // unicode string in formatierten unicode string Ausgabe: wprintf(L"%s\n", L"foo18"); // VS: ok, GCC: nicht ok - os-abhängiges Verhalten wprintf(L"%S\n", L"foo19"); // VS: nicht ok, GCC: ok - os-abhängiges Verhalten wprintf(L"%hs\n", L"foo20"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein hs wprintf(L"%ls\n", L"foo21"); // VS: ok, GCC: ok - wie erwartet wprintf(L"%hS\n", L"foo22"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein hS wprintf(L"%lS\n", L"foo23"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein lS // Fazit -> unicode into unicode: nur %ls funzt plattformunabhängig
Die ich auch fleißig nutze, aber das bedeutet eben, um widestrings komme ich dennoch nicht rum.antisteo hat geschrieben:Dazu hat Lazarus dann die Funktion utf8towidestring ;) (oder ich glaub der castet sogar implizit)kaiserludi hat geschrieben:Wenn die lösung so einfach wäre, aber dummerweise unterstützen wir auch Plattformen, auf denen UTF8-Support praktisch nicht vorhanden ist und man daher auf widestrings angewiesen ist, von sonstigen auch auf anderen Plattformen vorhandenen Nachteilen von utf8 in der API (Performance und Komplexität von Operationen auf dem String, wenn nicht alle Characters die gleiche Größe haben) mal ganz zu schweigen.antisteo hat geschrieben:That's the reason why you should use utf-8kaiserludi hat geschrieben:Kopf -> WandCode: Alles auswählen
// Formatierte Stringausgabe in C: // ascii string in formatierten ascii string Ausgabe: printf("%s\n", "foo0"); // VS: ok, GCC: ok - wie erwartet printf("%S\n", "foo1"); // VS: nicht ok, GCC: nicht ok - wie erwartet printf("%hs\n", "foo2"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein hs printf("%ls\n", "foo3"); // VS: nicht ok, GCC: nicht ok - wie erwartet printf("%hS\n", "foo4"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein hS printf("%lS\n", "foo5"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein lS // Fazit -> ascii into ascii: nur %s funzt plattformunabhängig // unicode string in formatierten ascii string Ausgabe: printf("%s\n", L"foo6"); // VS: nicht ok, GCC: nicht ok - wie erwartet printf("%S\n", L"foo7"); // VS: ok, GCC: ok - wie erwartet printf("%hs\n", L"foo8"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein hs printf("%ls\n", L"foo9"); // VS: ok, GCC: ok - wie erwartet printf("%hS\n", L"foo10"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein Hs printf("%lS\n", L"foo11"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein lS // Fazit -> unicode into ascii: %S und %ls funzen plattformunabhängig // ascii string in formatierten unicode string Ausgabe: wprintf(L"%s\n", "foo12"); // VS: nicht ok, GCC: ok - os-abhängiges Verhalten wprintf(L"%S\n", "foo13"); // VS: ok, GCC: nicht ok - os-abhängiges Verhalten wprintf(L"%hs\n", "foo14"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein hs wprintf(L"%ls\n", "foo15"); // VS: nicht ok, GCC: nicht ok - wie erwartet wprintf(L"%hS\n", "foo16"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein hS wprintf(L"%lS\n", "foo17"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein lS // Fazit -> ascii into unicode: überhaupt nichts funzt plattformunabhängig // unicode string in formatierten unicode string Ausgabe: wprintf(L"%s\n", L"foo18"); // VS: ok, GCC: nicht ok - os-abhängiges Verhalten wprintf(L"%S\n", L"foo19"); // VS: nicht ok, GCC: ok - os-abhängiges Verhalten wprintf(L"%hs\n", L"foo20"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein hs wprintf(L"%ls\n", L"foo21"); // VS: ok, GCC: ok - wie erwartet wprintf(L"%hS\n", L"foo22"); // VS: nicht ok, GCC: compiler-warning - GCC unterstützt kein hS wprintf(L"%lS\n", L"foo23"); // VS: ok, GCC: compiler-warning - GCC unterstützt kein lS // Fazit -> unicode into unicode: nur %ls funzt plattformunabhängig
Code: Alles auswählen
// format specifiers:
#define FRMT_SPCFR_STRTOSTR_A ((EG_CHAR*)"s")
#define FRMT_SPCFR_WSTRTOSTR_A ((EG_CHAR*)"ls") // "%S" would also work
#if defined _EG_WINDOWS_PLATFORM || (defined _EG_MARMALADE_PLATFORM && !defined I3D_ARCH_ARM)
# define FRMT_SPCFR_STRTOWSTR_A ((EG_CHAR*)"S")
#else
# define FRMT_SPCFR_STRTOWSTR_A ((EG_CHAR*)"s")
#endif
#define FRMT_SPCFR_WSTRTOWSTR_A ((EG_CHAR*)"ls")
#define FRMT_SPCFR_STRTOSTR_W ((EG_CHAR*)L"s")
#define FRMT_SPCFR_WSTRTOSTR_W ((EG_CHAR*)L"ls") // "%S" would also work
#if defined _EG_WINDOWS_PLATFORM || (defined _EG_MARMALADE_PLATFORM && !defined I3D_ARCH_ARM)
# define FRMT_SPCFR_STRTOWSTR_W ((EG_CHAR*)L"S")
#else
# define FRMT_SPCFR_STRTOWSTR_W ((EG_CHAR*)L"s")
#endif
#define FRMT_SPCFR_WSTRTOWSTR_W ((EG_CHAR*)L"ls")
Wenn ich nicht ganz falsch liege, ist GLEW ein OpenSource Projekt. Was hindert dich daran mitzuarbeiten und deinen Fix upstream zu bringen, damit sich andere Leute nicht mehr drüber ärgern müssen?Artificial Mind hat geschrieben:Glew ist ein Drecksverein: benutzen seit Ewigkeiten glGetString(GL_EXTENSIONS) obwohl es seit OGL 3.1 removed ist ...
Also glew neukompiliert als C++ Projekt und intern das Problem gefixt...