1. C# / Говнокод #28068

    0

    1. 1
    2. 2
    3. 3
    int похуй = 0;
    string похуйПлюсПохуйСтр = "похуй+похуй = ";
    Console.WriteLine(похуйПлюсПохуйСтр + (похуй + похуй));

    Для ВП

    Vanilla, 03 Марта 2022

    Комментарии (8)
  2. C++ / Говнокод #28066

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    #define CONSTRUCT_JUMP(name_, opcode_) else if(mnemonic.name == #name_) \
    	subcompileMnemonic(mnemonic, {\
    	{constructDescription(CONSTANT), opcode_},\
    	{constructDescription(LABEL), opcode_}})
    
    	CONSTRUCT_JUMP(JMP, JMP);
    
    	CONSTRUCT_JUMP(JE, JZ);
    	CONSTRUCT_JUMP(JZ, JZ);
    
    	CONSTRUCT_JUMP(JNZ, JNZ);
    	CONSTRUCT_JUMP(JNE, JNZ);
    
    	CONSTRUCT_JUMP(JG, JG);
    	CONSTRUCT_JUMP(JNLE, JG);
    	CONSTRUCT_JUMP(JNLZ, JG);
    
    	CONSTRUCT_JUMP(JLE, JNG);
    	CONSTRUCT_JUMP(JLZ, JNG);
    	CONSTRUCT_JUMP(JNG, JNG);
    
    	CONSTRUCT_JUMP(JGE, JGZ);
    	CONSTRUCT_JUMP(JGZ, JGZ);
    	CONSTRUCT_JUMP(JNL, JGZ);
    
    	CONSTRUCT_JUMP(JNGZ, JL);
    	CONSTRUCT_JUMP(JNGE, JL);
    	CONSTRUCT_JUMP(JL  , JL);
    
    	CONSTRUCT_JUMP(JB, JB);
    	CONSTRUCT_JUMP(JNAE, JB);
    	CONSTRUCT_JUMP(JNAZ, JB);
    	CONSTRUCT_JUMP(JC, JB);
    
    	CONSTRUCT_JUMP(JNB, JNB);
    	CONSTRUCT_JUMP(JAE, JNB);
    	CONSTRUCT_JUMP(JAZ, JNB);
    	CONSTRUCT_JUMP(JNC, JNB);
    
    	CONSTRUCT_JUMP(JBE, JBZ);
    	CONSTRUCT_JUMP(JBZ, JBZ);
    	CONSTRUCT_JUMP(JNA, JBZ);
    
    	CONSTRUCT_JUMP(JA, JA);
    	CONSTRUCT_JUMP(JNBE, JA);
    	CONSTRUCT_JUMP(JNBZ, JA);
    
    	CONSTRUCT_JUMP(CALL, CALL);
    #undef CONSTRUCT_JUMP

    kcalbCube, 01 Марта 2022

    Комментарии (22)
  3. C++ / Говнокод #28065

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    #define CONSTRUCT_JUMP(name_, opcode_) else if(mnemonic.name == #name_) \
    	subcompileMnemonic(mnemonic, {\
    	{constructDescription(CONSTANT), opcode_},\
    	{constructDescription(LABEL), opcode_}})
    
    	CONSTRUCT_JUMP(JMP, JMP);
    
    	CONSTRUCT_JUMP(JE, JZ);
    	CONSTRUCT_JUMP(JZ, JZ);
    
    	CONSTRUCT_JUMP(JNZ, JNZ);
    	CONSTRUCT_JUMP(JNE, JNZ);
    
    	CONSTRUCT_JUMP(JG, JG);
    	CONSTRUCT_JUMP(JNLE, JG);
    	CONSTRUCT_JUMP(JNLZ, JG);
    
    	CONSTRUCT_JUMP(JLE, JNG);
    	CONSTRUCT_JUMP(JLZ, JNG);
    	CONSTRUCT_JUMP(JNG, JNG);
    
    	CONSTRUCT_JUMP(JGE, JGZ);
    	CONSTRUCT_JUMP(JGZ, JGZ);
    	CONSTRUCT_JUMP(JNL, JGZ);
    
    	CONSTRUCT_JUMP(JNGZ, JL);
    	CONSTRUCT_JUMP(JNGE, JL);
    	CONSTRUCT_JUMP(JL  , JL);
    
    	CONSTRUCT_JUMP(JB, JB);
    	CONSTRUCT_JUMP(JNAE, JB);
    	CONSTRUCT_JUMP(JNAZ, JB);
    	CONSTRUCT_JUMP(JC, JB);
    
    	CONSTRUCT_JUMP(JNB, JNB);
    	CONSTRUCT_JUMP(JAE, JNB);
    	CONSTRUCT_JUMP(JAZ, JNB);
    	CONSTRUCT_JUMP(JNC, JNB);
    
    	CONSTRUCT_JUMP(JBE, JBZ);
    	CONSTRUCT_JUMP(JBZ, JBZ);
    	CONSTRUCT_JUMP(JNA, JBZ);
    
    	CONSTRUCT_JUMP(JA, JA);
    	CONSTRUCT_JUMP(JNBE, JA);
    	CONSTRUCT_JUMP(JNBZ, JA);
    
    	CONSTRUCT_JUMP(CALL, CALL);
    #undef CONSTRUCT_JUMP

    kcalbCube, 01 Марта 2022

    Комментарии (3)
  4. Java / Говнокод #28064

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    boolean isEven(int number) {
        while (number > 2) {
            number = number - 2;
        }
        if (number == 2) {
            return true;
        } else {
            return false;
        }
    }

    Мистер Хэнки, 28 Февраля 2022

    Комментарии (7)
  5. Lua / Говнокод #28063

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    Писать однострочный код это плохо? А если в одном файле совместить серверную и клиентскую часть? Пример аддона из Garry's Mod https://steamcommunity.com/sharedfiles/filedetails/?id=2754127067
    AddCSLua("cl_init.lua")
    if istable( xdestore ) then if xdestore.Menu then xdestore.Menu:Remove() end  if xdestore.Unlock then xdestore.Unlock:Remove() end
    if xdestore.Namer then xdestore.Namer:Remove() end  if xdestore.Lock then xdestore.Lock:Remove() end end xdestore = {} xdestore.Players = {}
    
    	util.AddNetworkString( "XDEST_MenuS2COpen" ) util.AddNetworkString( "XDEST_MenuS2CClose" ) util.AddNetworkString( "XDEST_SendRes" )
    	util.AddNetworkString( "XDEST_MenuS2CUpdate" ) util.AddNetworkString( "XDEST_MenuS2CResult" ) util.AddNetworkString( "XDEST_MenuC2SClose" )
    	util.AddNetworkString( "XDEST_LockReset" ) util.AddNetworkString( "XDEST_MenuC2SAction" ) util.AddNetworkString( "XDEST_SendSnd" ) util.AddNetworkString( "XDEST_SendHint" )
    
    xdestore.AmmoMdl = {
    	[ "AR2" ] = "models/items/combine_rifle_cartridge01.mdl",
    	[ "AR2AltFire" ] = "models/items/combine_rifle_ammo01.mdl",
    	[ "Pistol" ] = "models/items/boxsrounds.mdl",
    	[ "SMG1" ] = "models/items/boxmrounds.mdl",
    	[ "357" ] = "models/items/357ammo.mdl",
    	[ "XBowBolt" ] = "models/items/crossbowrounds.mdl",
    	[ "Buckshot" ] = "models/items/boxbuckshot.mdl",
    	[ "RPG_Round" ] = "models/weapons/w_missile_closed.mdl",
    	[ "SMG1_Grenade" ] = "models/items/ar2_grenade.mdl",
    	[ "Grenade" ] = "models/items/grenadeammo.mdl",
    	[ "slam" ] = "models/weapons/w_slam.mdl"
    }
    xdestore.NonSWEP = {
    	[ "weapon_357" ] = "models/weapons/w_357.mdl",
    	[ "weapon_pistol" ] = "models/weapons/w_pistol.mdl",
    	[ "weapon_bugbait" ] = "models/weapons/w_bugbait.mdl",
    	[ "weapon_crossbow" ] = "models/weapons/w_crossbow.mdl",
    	[ "weapon_crowbar" ] = "models/weapons/w_crowbar.mdl",
    	[ "weapon_frag" ] = "models/weapons/w_grenade.mdl",
    	[ "weapon_physcannon" ] = "models/weapons/w_physics.mdl",
    	[ "weapon_ar2" ] = "models/weapons/w_irifle.mdl",
    	[ "weapon_rpg" ] = "models/weapons/w_rocket_launcher.mdl",
    	[ "weapon_slam" ] = "models/weapons/w_slam.mdl",
    	[ "weapon_shotgun" ] = "models/weapons/w_shotgun.mdl",
    	[ "weapon_smg1" ] = "models/weapons/w_smg1.mdl",
    	[ "weapon_stunstick" ] = "models/weapons/w_stunbaton.mdl",
    	[ "weapon_alyxgun" ] = "models/weapons/w_alyx_gun.mdl",
    	[ "weapon_annabelle" ] = "models/weapons/w_annabelle.mdl",
    	[ "weapon_physgun" ] = "models/weapons/w_physics.mdl"
    }
    xdestore.ValidAct = { [ "Take" ] = true, [ "Move" ] = true, [ "Store" ] = true, [ "Rename" ] = true, [ "TakeAll" ] = true, [ "Split" ] = true, [ "Lock" ] = true, [ "Unlock" ] = true }
    xdestore.ActToNum = { "Take", "Move", "Store", "TakeAll", "Rename", "Split", "Lock", "Unlock" }
    xdestore.LockType = { "Simple", "Complex", "Question", "Key Weapon", "Group", "Personal" }
    net.Receive( "XDEST_MenuS2COpen", function() local int = net.ReadFloat()  local tab = net.ReadString()  local con = net.ReadString()
    local ent = net.ReadEntity() xdestore:OpenMenu( ply, int, tab, con, ent ) end )
    net.Receive( "XDEST_MenuS2CClose", function() if xdestore.Menu then xdestore.Menu:Remove() end  if xdestore.Namer then xdestore.Namer:Remove() end
    if xdestore.Lock then xdestore.Lock:Remove() end  if xdestore.Unlock then xdestore.Unlock:Remove() end end )
    net.Receive( "XDEST_MenuS2CUpdate", function()
    	local tab = util.JSONToTable( net.ReadString() )  local con = util.JSONToTable( net.ReadString() )  local aa = net.ReadBool()  local bb = net.ReadBool()
    	if IsValid( xdestore.Menu ) then xdestore.Menu.V_DataStat = tab  xdestore.Menu.V_DataCont = con  xdestore.Menu:UpdateItems( aa, bb ) end
    end )
    net.Receive( "XDEST_MenuC2SClose", function( len, ply ) if len > 32 or !IsValid( ply ) then return end
    	local int = net.ReadFloat() if IsValid( ply ) and ply:IsPlayer() and !ply:IsBot() and isnumber( int ) then xdestore:CloseMenu( ply, int ) end
    end )
    net.Receive( "XDEST_MenuC2SAction", function( len, ply ) if len >= 4096 or !IsValid( ply ) then return end
    	if isnumber( ply.XDEST_Cool ) and ply.XDEST_Cool > CurTime() then xdestore:SendHint( ply, "You are doing too fast!", "resource/warning.wav", 0 ) end
    	ply.XDEST_Cool = CurTime()+0.25  if !IsValid( ply:GetNWEntity( "XDEST_Ent" ) ) or ply:GetNWEntity( "XDEST_Ent" ) == Entity( 0 ) then return end local self = ply:GetNWEntity( "XDEST_Ent" )
    	if ( ( !isstring( self.Base ) or self.Base != "xdest_base" ) and self:GetClass() != "xdest_base" and self:GetClass() != "weapon_xdest" )
    	or !isstring( self.XDEST_Data ) or !isstring( self.XDEST_Contain ) then return end
    	local act = net.ReadFloat()  local str = net.ReadString() if !isnumber( act ) then return end act = math.Round( act )
    	if !isstring( str ) then str = "_" end if isstring( xdestore.ActToNum[ act ] ) then act = xdestore.ActToNum[ act ] else return end  xdestore:SlotAction( ply, self, act, str )
    end )
    net.Receive( "XDEST_MenuS2CResult", function() local ply = LocalPlayer() local yes = net.ReadBool()  if IsValid( xdestore.Unlock ) then xdestore.Unlock:XDE_Result( yes ) end end )
    net.Receive( "XDEST_LockReset", function() local ent = net.ReadEntity() if IsValid( ent ) and ent != Entity( 0 ) then ent.XDE_Pass = nil end end )
    net.Receive( "XDEST_SendSnd", function() local str = net.ReadString() if !isstring( str ) or str == "!V" then return end surface.PlaySound( str ) end )
    net.Receive( "XDEST_SendRes", function() local str = net.ReadString()  local ply = LocalPlayer()  local ent = net.ReadEntity() if !IsValid( ent )
    or ent == Entity( 0 ) or !isstring( str ) or str == "" then return end if !isstring( ent.XDE_Pass ) then xdestore:SendHint( nil, "Access granted.", "", 0 ) end ent.XDE_Pass = str end )
    net.Receive( "XDEST_SendHint", function() local txt = net.ReadString()  local snd = net.ReadString()  local typ = net.ReadFloat()  xdestore:SendHint( nil, txt, snd, typ ) end )

    Ivan_Evlasiev, 28 Февраля 2022

    Комментарии (1)
  6. Си / Говнокод #28061

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    #pragma aux __cdecl "_*"                            \
                    parm caller [ ]                          \
                    value struct float struct routine [eax] \
                    modify [eax ecx edx]

    kcalbCube, 28 Февраля 2022

    Комментарии (11)
  7. Assembler / Говнокод #28059

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    .org 80h
    inc:
    	push %bp
    	mov %bp %sp
    	sub %sp 0010h
    	mov [%bp + FFFEh] %sp
    	mov [%bp + FFFCh] %b
    	lea %a [%bp + FFFCh]
    	mov %a [%a]
    	push %a
    	inc %a
    	pop %si
    	mov [%si] %a
    	jmp @.return.inc
    .return.inc:
    	mov %sp %bp
    	pop %bp
    	ret
    main:
    	push %bp
    	mov %bp %sp
    	sub %sp 0010h
    	mov [%bp + FFFCh] %sp
    	memset [%bp + FFFEh] 0002h 0h
    	lea %a [%bp + FFFEh]
    	push %a
    	mov %a 0000h
    	pop %si
    	mov [%si] %a
    .L.begin.1:
    	mov %a 0001h
    	cmp %a 0h
    	jz @.0
    	lea %a [%bp + FFFEh]
    	push %a
    	pop %b
    	call @inc
    	push %a
    	mov %a 0050h
    	pop %si
    	cmp %si %a
    	jgz @.compare3
    	mov %al 1h
    	.compare3:
    	mov %ah 0h
    	cmp %a 0h
    	jz  @.else.2
    	jmp @.0
    	jmp @.end.2
    .else.2:
    .end.2:
    .1:
    	jmp @.L.begin.1
    .0:
    .return.main:
    	mov %sp %bp
    	pop %bp
    	ret
    start:
    	mov %sp FFFFh
    	call @main
    .return.start:
    	int 0h
    
    <-------------------->
    
    short inc(short* i)
    {
    	return ++(*i);
    }
    
    void main(void)
    {
    	short i = 0s;
    	while(1) 
    	{
    		if(inc(&i) > 0x50)
    			break;
    	}
    }
    
    void start(void)
    {
    	asm("mov %sp FFFFh");
    	main();
    }

    да что вы знаете о неоптимизированном коде

    kcalbCube, 27 Февраля 2022

    Комментарии (0)
  8. Си / Говнокод #28058

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    #include <stdio.h>
    
    int main(void)
    {
    	(
    		*********************
    		**  **     ** ***** *
    		* ** * **** ** *** **
    		* ** * **** *** * ***
    		* ** * **** **** ****
    		* ** * **** *** * ***
    		* ** **    *** *** **
    		*********************
    	printf)("pidor");
    }

    kcalbCube, 26 Февраля 2022

    Комментарии (13)
  9. Си / Говнокод #28056

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    static char *cast_table[][11] = {
      // i8   i16     i32     i64     u8     u16     u32     u64     f32     f64     f80
      {NULL,  NULL,   NULL,   i32i64, i32u8, i32u16, NULL,   i32i64, i32f32, i32f64, i32f80}, // i8
      {i32i8, NULL,   NULL,   i32i64, i32u8, i32u16, NULL,   i32i64, i32f32, i32f64, i32f80}, // i16
      {i32i8, i32i16, NULL,   i32i64, i32u8, i32u16, NULL,   i32i64, i32f32, i32f64, i32f80}, // i32
      {i32i8, i32i16, NULL,   NULL,   i32u8, i32u16, NULL,   NULL,   i64f32, i64f64, i64f80}, // i64
    
      {i32i8, NULL,   NULL,   i32i64, NULL,  NULL,   NULL,   i32i64, i32f32, i32f64, i32f80}, // u8
      {i32i8, i32i16, NULL,   i32i64, i32u8, NULL,   NULL,   i32i64, i32f32, i32f64, i32f80}, // u16
      {i32i8, i32i16, NULL,   u32i64, i32u8, i32u16, NULL,   u32i64, u32f32, u32f64, u32f80}, // u32
      {i32i8, i32i16, NULL,   NULL,   i32u8, i32u16, NULL,   NULL,   u64f32, u64f64, u64f80}, // u64
    
      {f32i8, f32i16, f32i32, f32i64, f32u8, f32u16, f32u32, f32u64, NULL,   f32f64, f32f80}, // f32
      {f64i8, f64i16, f64i32, f64i64, f64u8, f64u16, f64u32, f64u64, f64f32, NULL,   f64f80}, // f64
      {f80i8, f80i16, f80i32, f80i64, f80u8, f80u16, f80u32, f80u64, f80f32, f80f64, NULL},   // f80
    };

    красивое

    kcalbCube, 26 Февраля 2022

    Комментарии (2)
  10. Си / Говнокод #28055

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    // Takes a printf-style format string and returns a formatted string.
    char *format(char *fmt, ...) {
      char *buf;
      size_t buflen;
      FILE *out = open_memstream(&buf, &buflen);
    
      va_list ap;
      va_start(ap, fmt);
      vfprintf(out, fmt, ap);
      va_end(ap);
      fclose(out);
      return buf;
    }

    kcalbCube, 25 Февраля 2022

    Комментарии (6)