From: Daniele F. <df...@gm...> - 2012-07-19 13:23:43
|
2012/7/19 Hans Petter Selasky: > Declaring variables inside a for loop is a C++ feature, not a C feature ?? it's C++ and C99 section "6.8.5 Iteration statements" > At least the compiler over here: cc (GCC) 4.2.1 20070831 patched [FreeBSD] > > Complained. only on that line? I'm asking because also declaring the variable in the middle of the code is a C++ and C99 feature and similar code is used in several places: $ grep "for (" . -rn --include=*.c | grep int ./libgtkpod/gtkpod_app_iface.c:640: for (gint i = 0; i < g_list_length(gp_iface->track_commands); ++i) { ./plugins/sorttab_display/sorttab_widget.c:336: for (gint i = 0; i < ST_CAT_NUM; ++i) { ./plugins/sorttab_display/display_sorttabs.c:69: for (gint i = 0; i < sort_tab_total; ++i) { ./plugins/clarity/clarity_canvas.c:598: for (gint i = 0; i < g_list_length(priv->covers); ++i) { ./plugins/playlist_display/display_playlists.c:1073: for (gint i = 0; i < g_list_length(playlists); ++i) { -- Daniele Forsi |