- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
try {
if (something) {
throw new MyGotoException();
}
DoSomethingElse();
}
catch (MyGotoException) {
}
DoGotoBlock();
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+152
try {
if (something) {
throw new MyGotoException();
}
DoSomethingElse();
}
catch (MyGotoException) {
}
DoGotoBlock();
Очень хитрый вариант реализации схемы goto.
+147
if (chk.Checked)
{
foreach (BV.Star.BLL.PersonGroups.PersonGroup trainee in trainees)
{
if (trainee.TraineeID.ToString() == gvwTrainees.DataKeys[gvwTrainees.PageIndex == 0 ? gvr.DataItemIndex : (gvr.DataItemIndex % gvwTrainees.PageSize)].Value.ToString())
goto Next;
}
InsertTraineeIntoGroup(Int32.Parse(ddlGroups.SelectedValue),
Int32.Parse(gvwTrainees.DataKeys[gvwTrainees.PageIndex == 0 ? gvr.DataItemIndex : (gvr.DataItemIndex % gvwTrainees.PageSize)].Value.ToString()),
false, DateTime.MaxValue,
"");
Next: ;
}
И снова на сцене - goto!
+143.1
if (((HttpContext.Current.Profile as ProfileCommon).Role == "3") || ((HttpContext.Current.Profile as ProfileCommon).Role == "4"))
{
if (e.Item.Value == " Add New Trainee ")
e.Item.Enabled = false;
if (e.Item.Value == " Add New Group ")
e.Item.Enabled = false;
if (e.Item.Value == " Audit Log ")
e.Item.Enabled = false;
if (e.Item.Value == " Manage Holidays ")
e.Item.Enabled = false;
}
if ( (( HttpContext.Current.Profile as ProfileCommon).Role != "0") && (( HttpContext.Current.Profile as ProfileCommon).Role != "") )
{
if (e.Item.Value == " Manage Users ")
e.Item.Enabled = false;
if (e.Item.Value == " Manage Courses ")
e.Item.Enabled = false;
if (e.Item.Value == " Audit Log ")
e.Item.Enabled = false;
}
if (((HttpContext.Current.Profile as ProfileCommon).Role == "") ||
((HttpContext.Current.Profile as ProfileCommon).Role == "0") ||
((HttpContext.Current.Profile as ProfileCommon).Role == "1") ||
((HttpContext.Current.Profile as ProfileCommon).Role == "2"))
{
if (e.Item.Value == " Holidays ")
e.Item.Enabled = false;
}
Новое место работы. Новые порции говнокода.
Это классика - no comments...
+157.6
$result = preg_replace("/(\d\d,\d\d)\d\d/", "$1", $result);
Не хотелось, а пришлось - это в большом потоке не очень хорошо структурированных данных так округляются числа, с четырёх до двух знаков после запятой.
+135.8
Xgetc(fp); /* the extension code */
for ( i = Xgetc(fp); i > 0; i-- ) Xgetc(fp);
while ( ( i = Xgetc(fp) ) > 0 ) {
for ( i = i ; i > 0; i-- ) Xgetc(fp);
}
Кусок из whirlgif - whirlgif.c
* This program reads in a sequence of single-image Gif format files and
* outputs a single multi-image Gif file, suitable for use as an animation.
Поубивал бы!
+151.4
http://suchen.mobile.de/fahrzeuge/showDetails.html?lang=ru&id=74773331&pageNumber=3&scopeId=C&sortOption.sortBy=searchNetGrossPrice&sortOption.sortOrder=ASCENDING&makeModelVariant1.makeId=17700&makeModelVariant1.modelId=13&makeModelVariant1.searchInFreetext=false&makeModelVariant2.searchInFreetext=false&makeModelVariant3.searchInFreetext=false&vehicleCategory=Car&segment=Car&minFirstRegistrationDate=1995-01-01&siteId=GERMANY&damageUnrepaired=ALSO_DAMAGE_UNREPAIRED&export=ALSO_EXPORT&customerIdsAsString=&tabNumber=2
небольшой такой запросик...
+142
[root@v6704 debug]# make
[ 1%] Generating moc_wordplugin.cxx
Scanning dependencies of target gluxi_plugin_word
[ 1%] Building CXX object src/plugins/word/CMakeFiles/gluxi_plugin_word.dir/wordplugin.o
/home/gluxi/src/plugins/word/wordplugin.cpp: In member function ‘virtual bool WordPlugin::parseMessage(gloox::Stanza*)’:
/home/gluxi/src/plugins/word/wordplugin.cpp:104: error: ‘class gloox::Stanza’ has no member named ‘addAttribute’
/home/gluxi/src/plugins/word/wordplugin.cpp:105: error: ‘class gloox::Stanza’ has no member named ‘finalize’
/home/gluxi/src/plugins/word/wordplugin.cpp:106: error: ‘class gloox::Stanza’ has no member named ‘xml’
/home/gluxi/src/plugins/word/wordplugin.cpp:136: error: ‘class gloox::Stanza’ has no member named ‘addAttribute’
/home/gluxi/src/plugins/word/wordplugin.cpp:137: error: ‘class gloox::Stanza’ has no member named ‘finalize’
make[2]: *** [src/plugins/word/CMakeFiles/gluxi_plugin_word.dir/wordplugin.o] Error 1
make[1]: *** [src/plugins/word/CMakeFiles/gluxi_plugin_word.dir/all] Error 2
make: *** [all] Error 2
продолжаем говнокодить
+139
debug]# cmake ..
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Check size of void*
-- Check size of void* - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found.
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found.
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - not found.
-- Found Qt-Version 4.3.4
-- Looking for _POSIX_TIMERS
-- Looking for _POSIX_TIMERS - found
-- Found OpenSSL: /usr/lib/libssl.so
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Finding plugins in /home/gluxi/src/plugins
-- -> Found plugin: word
-- -> Found plugin: net
-- -> Found plugin: webstatus
-- -> Found plugin: muc
-- -> Found plugin: config
-- -> Found plugin: core
-- -> Found plugin: misc
-- -> Found plugin: user
-- -> Found plugin: alias
-- -> Found plugin: admin
-- PluginLoader generated
-- Configuring done
-- Generating done
-- Build files have been written to: /home/gluxi/debug
не понятно
+142
case MOTO_ACCY_IOCTL_SET_CHARGER_LOAD_LINE:
/* Copy the load line setting from user space */
retval = copy_from_user ((void *)&data, (void *)arg, sizeof(data));
/* If the copy failed, return an error */
if (retval != 0)
{
retval = -EFAULT;
}
/* Else, configure the hardware for the requested load line setting */
else
{
/* Acquire the lock to prevent changes to connected_accessories */
spin_lock (&connected_lock);
/* Verify that the 3G fast charger is connected */
if (ACCY_BITMASK_ISSET(connected_accessories, MOTO_ACCY_TYPE_CHARGER_FAST_3G))
{
/* This charger is the only charger that supports an adjustable load line */
/* TBD */
}
/* Else, the appropriate charger type is not connected */
else
{
/* Return error: No such device */
retval = -ENODEV;
}
/* Release the lock for connected_accessories */
spin_unlock (&connected_lock);
}
break;
+145.4
индокод:
#ifdef PRINT_DEBUG_INFO
#define DBG_PRINT if(1) printf
#else
#define DBG_PRINT if(0) printf
#endif
Индокод - макрос для вкл-выкл дебажной печати.