- 1
 
signed bool
                                    Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
Всего: 9
+147
signed bool
                                    
+146
void swap(word& w)
{
     w=w<<8|w>>8;
};
                                    И так, стартует конкурс "самый красивый swap". Жду ваши варианты. Призов не будет, так чисто пожрать.
+952
namespace AppendStrinAtBegin
{
    class Program
    {
        static void ProcessDirectory(string path, string fileMask, Action<string> action)
        {
            Directory.EnumerateFiles(path, fileMask).ToList().ForEach(action);
            Directory.EnumerateDirectories(path).ToList().ForEach
                (
                    subDirectory => ProcessDirectory(subDirectory, fileMask, action)
                );
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Path FileMask AppendedString");
            if (args.Length < 3)
                return;
            var appendedString = args.Skip(2).Aggregate((workingSentence, next) => workingSentence+ " " +next);
            ProcessDirectory(args[0], args[1], (file) => ProcessFile(file, appendedString));
            Console.WriteLine("Gun done");
        }
        static void ProcessFile(string file, string appendedStringAtBegin)
        {
            var fileLines = File.ReadAllLines(file, Encoding.GetEncoding(1251));
            var fileResulted = fileLines.ToList();
            fileResulted.Insert(0, appendedStringAtBegin);
            File.WriteAllLines(file, fileResulted, Encoding.GetEncoding(1251));
        }
    }
}
                                    
+1007
template <typename T, typename U>
auto operator()(T&& t, U&& u) const
-> decltype(forward<T>(t) + forward<U>(u)) {
    return forward<T>(t) + forward<U>(u);
}
                                    
+1000
#include <iostream>
#include <stdio.h>
#include <fcntl.h>
#include <string>
#define print(data) cout<<data<<endl;
#define ord(data) int(data[0])
#define str(data) char(data)
#define open fopen
#define write(f, data) fputc(data, f)
using namespace std;
string input()
{
        string s;
        cin>>s;
        return s;
};
FILE* f;
int chr;
 
int main() {
        print("Enter:");
        f = open("code.txt", "w");
        chr = ord(input());
        print(chr);
        write(f, str(chr));
        return 0;
}
                                    
            Вот такую лабу сдал студент 1го курса в нашем вузе. Сказал преподавателю, что ему очень нравится питон и он старается ему подражать.
http://ideone.com/ctkFP
        
+146
main(){}
                                    Минимальная программа на Си.
+153
auto L = [](int i)->int { return i+1; };
typedef decltype(L) TL;
auto lfunc = &TL::operator();
int i = (L.*lfunc)(1);
                                    
+154
class Allocator
{
public:
  
  virtual void *Alloc (size_t) = 0;
  virtual void Dealloc (void *) = 0;
  struct Allocation
  {
    Allocator *m_pAllocator[1];
    static void Dealloc (void *ptr)
    {
      if (ptr)
        ((Allocator **)ptr)[-1]->Dealloc (((Allocator **)ptr)-1);
    }
  };
};
class UsesAllocator
{
public:
  void *operator new (size_t aSize,Allocator &aAllocator)
  {
    Allocator::Allocation *pResult =
      (Allocator::Allocation *)
      aAllocator.Alloc (aSize+sizeof (Allocator::Allocation));
    if (!pResult) throw std::bad_alloc ();
    pResult->m_pAllocator[0] = &aAllocator;
    return pResult->m_pAllocator+1;
  }
  void *operator new [] (size_t aSize,Allocator &aAllocator)
  {
    Allocator::Allocation *pResult =
      (Allocator::Allocation *)
      aAllocator.Alloc (aSize+sizeof (Allocator::Allocation));
    if (!pResult) throw std::bad_alloc ();
    pResult->m_pAllocator[0] = &aAllocator;
    return pResult->m_pAllocator+1;
  }
  void operator delete (void *ptr,Allocator &)
  { Allocator::Allocation::Dealloc (ptr); }
  void operator delete (void *ptr)
  { Allocator::Allocation::Dealloc (ptr); }
  void operator delete [] (void *ptr,Allocator &)
  { Allocator::Allocation::Dealloc (ptr); }
  void operator delete [] (void *ptr)
  { Allocator::Allocation::Dealloc (ptr); }
};
...
class MyClass: /*virtual*/ public UsesAllocator
{
public:
  ...
};
...
MyClass *PROFIT = new (allocatorOfOurInterest) MyClass (...);
                                    
http://www.gamedev.ru/flame/forum/?id=153274+123
При попытке выйти с из логина:
http://govnokod.ru/user/exit/?url=http%3A%2F%2Fgovnokod.ru%2Fadd
получаем говно:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 72 bytes) in /home/striker/www/index.php on line 507