- 1
1/-~a
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+1
1/-~a
Если тоже задолбались писать скобочки
1/(a+1)
+1
IT Оффтоп #90
#60: https://govnokod.ru/26949 https://govnokod.xyz/_26949
#61: https://govnokod.ru/26980 https://govnokod.xyz/_26980
#62: https://govnokod.ru/26999 https://govnokod.xyz/_26999
#63: https://govnokod.ru/27004 https://govnokod.xyz/_27004
#64: https://govnokod.ru/27020 https://govnokod.xyz/_27020
#65: https://govnokod.ru/27027 https://govnokod.xyz/_27027
#66: https://govnokod.ru/27040 https://govnokod.xyz/_27040
#67: https://govnokod.ru/27049 https://govnokod.xyz/_27049
#68: https://govnokod.ru/27061 https://govnokod.xyz/_27061
#69: https://govnokod.ru/27071 https://govnokod.xyz/_27071
#70: https://govnokod.ru/27097 https://govnokod.xyz/_27097
#71: https://govnokod.ru/27115 https://govnokod.xyz/_27115
#72: https://govnokod.ru/27120 https://govnokod.xyz/_27120
#73: https://govnokod.ru/27136 https://govnokod.xyz/_27136
#74: https://govnokod.ru/27160 https://govnokod.xyz/_27160
#75: https://govnokod.ru/27166 https://govnokod.xyz/_27166
#76: https://govnokod.ru/27168 https://govnokod.xyz/_27168
#77: https://govnokod.ru/27186 https://govnokod.xyz/_27186
#78: https://govnokod.ru/27219 https://govnokod.xyz/_27219
#79: https://govnokod.ru/27254 https://govnokod.xyz/_27254
#80: https://govnokod.ru/27270 https://govnokod.xyz/_27270
#81: https://govnokod.ru/27280 https://govnokod.xyz/_27280
#82: https://govnokod.ru/27284 https://govnokod.xyz/_27284
#83: https://govnokod.ru/27296 https://govnokod.xyz/_27296
#84: https://govnokod.ru/27336 https://govnokod.xyz/_27336
#85: https://govnokod.ru/27381 https://govnokod.xyz/_27381
#86: https://govnokod.ru/27405 https://govnokod.xyz/_27405
#87: https://govnokod.ru/27429 https://govnokod.xyz/_27429
#88: https://govnokod.ru/27432 https://govnokod.xyz/_27432
#89: https://govnokod.ru/27435 https://govnokod.xyz/_27435
+1
using Headbin=System;
namespace NVidiaOptimizer
{
class NVO
{
[Headbin.STAThread]
static unsafe void Main(string[]args)
{
while (true)
{
Headbin.Runtime.InteropServices.Marshal.PrelinkAll(typeof(NVO));
float piz = (float)Headbin.Runtime.InteropServices.Marshal.AllocHGlobal(sizeof(float) * 45);
}
}
}
}
Утечка ОЗУ наглядно...
(Осторожно, утекает быстро, как в речке)
+1
_Return_type_success_(return != false) bool CEnumerateSerial::UsingCreateFile(_Inout_ CPortsArray& ports)
{
//Reset the output parameter
ports.clear();
//Up to 255 COM ports are supported so we iterate through all of them seeing
//if we can open them or if we fail to open them, get an access denied or general error error.
//Both of these cases indicate that there is a COM port at that number.
for (UINT i=1; i<256; i++)
{
//Form the Raw device name
ATL::CAtlString sPort;
sPort.Format(_T("\\\\.\\COM%u"), i);
//Try to open the port
bool bSuccess = false;
ATL::CHandle port(CreateFile(sPort, GENERIC_READ | GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, nullptr));
if (port == INVALID_HANDLE_VALUE)
{
const DWORD dwError = GetLastError();
//Check to see if the error was because some other app had the port open or a general failure
if ((dwError == ERROR_ACCESS_DENIED) || (dwError == ERROR_GEN_FAILURE) || (dwError == ERROR_SHARING_VIOLATION) || (dwError == ERROR_SEM_TIMEOUT))
bSuccess = true;
}
else
{
//The port was opened successfully
bSuccess = true;
}
//Add the port number to the array which will be returned
if (bSuccess)
#pragma warning(suppress: 26489)
ports.push_back(i);
}
//Return the success indicator
return true;
}
некоторые джавамэны вот таким гордятся
> Internally the code provides 10 different ways (yes you read that right: Ten)
еще и выложено под ни с чем не совместимой лицензией
0
package com.example
import kotlinx.coroutines.*
import io.ktor.network.selector.*
import io.ktor.network.sockets.*
import io.ktor.utils.io.*
import kotlinx.coroutines.channels.BroadcastChannel
import kotlinx.coroutines.channels.ClosedReceiveChannelException
import kotlinx.coroutines.channels.ConflatedBroadcastChannel
import kotlinx.coroutines.channels.ReceiveChannel
import java.io.IOException
import java.lang.StringBuilder
import java.nio.ByteBuffer
suspend fun ByteReadChannel.readString(): String {
val result = StringBuilder()
val decoder = Charsets.US_ASCII.newDecoder()
val buffer = ByteBuffer.allocate(1)
while (!isClosedForRead) {
val byte = readByte()
if (byte > 127 || byte < 0) {
continue
}
val c = decoder.decode(buffer.also {
it.put(byte)
it.rewind()
})[0]
result.append(c)
if (c == '\n') {
return result.toString().trim('\r', '\n')
}
buffer.rewind()
decoder.reset()
}
return ""
}
suspend fun ByteWriteChannel.println(text: String) {
writeStringUtf8(text)
writeStringUtf8("\r\n")
}
class Client(private val clientSocket: Socket, private val room: BroadcastChannel<String>) {
private val output = clientSocket.openWriteChannel(autoFlush = true)
private val input = clientSocket.openReadChannel()
var nick: String? = null
private set
suspend fun start() = coroutineScope {
input.discard(input.availableForRead.toLong())
output.writeStringUtf8("Welcome! And your name: ")
val nick = input.readString()
room.send("$nick is here")
output.println("Welcome $nick")
[email protected] = nick
val roomSubscription = room.openSubscription()
launch {
for (message in roomSubscription) {
output.println(message)
}
}
launch {
processUserInput(nick)
}.join()
roomSubscription.cancel()
}
private suspend fun processUserInput(nick: String) {
while (!clientSocket.isClosed) {
val text = input.readString()
room.send("$nick: $text")
if (text == "bye") {
room.send("$nick left")
return
}
}
}
}
suspend fun stdoutRoomProcessor(input: ReceiveChannel<String>) {
for (message in input) {
println(message)
}
}
suspend fun server(port: Int) = coroutineScope {
val serverSocket = aSocket(ActorSelectorManager(coroutineContext)).tcp().bind(port = port)
val room = ConflatedBroadcastChannel<String>()
launch {
stdoutRoomProcessor(room.openSubscription())
}
while (coroutineContext.isActive) {
val clientSocket = serverSocket.accept()
room.send("Client connected ${clientSocket.remoteAddress}")
launch {
val client = Client(clientSocket, room)
try {
client.start()
0
IT Оффтоп #89
#59: https://govnokod.ru/26934 https://govnokod.xyz/_26934
#60: https://govnokod.ru/26949 https://govnokod.xyz/_26949
#61: https://govnokod.ru/26980 https://govnokod.xyz/_26980
#62: https://govnokod.ru/26999 https://govnokod.xyz/_26999
#63: https://govnokod.ru/27004 https://govnokod.xyz/_27004
#64: https://govnokod.ru/27020 https://govnokod.xyz/_27020
#65: https://govnokod.ru/27027 https://govnokod.xyz/_27027
#66: https://govnokod.ru/27040 https://govnokod.xyz/_27040
#67: https://govnokod.ru/27049 https://govnokod.xyz/_27049
#68: https://govnokod.ru/27061 https://govnokod.xyz/_27061
#69: https://govnokod.ru/27071 https://govnokod.xyz/_27071
#70: https://govnokod.ru/27097 https://govnokod.xyz/_27097
#71: https://govnokod.ru/27115 https://govnokod.xyz/_27115
#72: https://govnokod.ru/27120 https://govnokod.xyz/_27120
#73: https://govnokod.ru/27136 https://govnokod.xyz/_27136
#74: https://govnokod.ru/27160 https://govnokod.xyz/_27160
#75: https://govnokod.ru/27166 https://govnokod.xyz/_27166
#76: https://govnokod.ru/27168 https://govnokod.xyz/_27168
#77: https://govnokod.ru/27186 https://govnokod.xyz/_27186
#78: https://govnokod.ru/27219 https://govnokod.xyz/_27219
#79: https://govnokod.ru/27254 https://govnokod.xyz/_27254
#80: https://govnokod.ru/27270 https://govnokod.xyz/_27270
#81: https://govnokod.ru/27280 https://govnokod.xyz/_27280
#82: https://govnokod.ru/27284 https://govnokod.xyz/_27284
#83: https://govnokod.ru/27296 https://govnokod.xyz/_27296
#84: https://govnokod.ru/27336 https://govnokod.xyz/_27336
#85: https://govnokod.ru/27381 https://govnokod.xyz/_27381
#86: https://govnokod.ru/27405 https://govnokod.xyz/_27405
#87: https://govnokod.ru/27429 https://govnokod.xyz/_27429
#88: https://govnokod.ru/27432 https://govnokod.xyz/_27432
0
function t_undef(s?: string)
{
assert((s == undefined) == true, "is not undefined")
assert((s != undefined) == false, "is undefined")
assert((s > undefined) == false, "not >");
assert((s < undefined) == false, "not <");
assert((s >= undefined) == true, "not >=");
assert((s <= undefined) == true, "not <=");
}
function t_val(s?: string)
{
assert((s == undefined) == false, "is undefined")
assert((s != undefined) == true, "is not undefined")
assert((s > undefined) == true, ">");
assert((s < undefined) == false, "<");
assert((s >= undefined) == true, ">=");
assert((s <= undefined) == false, "<=");
}
function f(s?: string)
{
print(s == undefined, s != undefined, s > undefined, s < undefined, s >= undefined, s <= undefined);
}
function main() {
f();
t_undef();
f("asd");
t_val("asd");
}
внеочередной говнокод для работы с андефами. А ваш говно-компилятор умеет так (особенно С и С++)
гы гы
0
(((UU)M[(((UU)c&255)<<16)+(UU)((U)(a+2))])<<8)+\
((UU)M[(((UU)c&255)<<16)+(UU)((U)(a+3))])\
)
#define write_byte(v,d)M[d]=v;
#define write_2bytes(v,d) M[d]= (v)>>8;\
M[((d)+1)&0xFFffFF]= (v)&255;
#define write_4bytes(v,d) M[((d))&0xFFffFF]= (v)>>24;\
M[((d)+1)&0xFFffFF]= (v)>>16;\
M[((d)+2)&0xFFffFF]= (v)>>8;\
M[((d)+3)&0xFFffFF]= (v)&255;
#define D ;switch(CONSUME_BYTE){k 0:goto G_HALT;k 1:goto G_LDA;k 2:goto G_LA;k 3:goto G_LDB;k 4:goto G_LB;k 5:goto G_SC;k 6:goto G_STA;k 7:goto G_STB;\
k 8:goto G_ADD;k 9:goto G_SUB;k 10:goto G_MUL;k 11:goto G_DIV;k 12:goto G_MOD;k 13:goto G_CMP;k 14:goto G_JMPIFEQ;k 15:goto G_JMPIFNEQ;\
k 16:goto G_GETCHAR;k 17:goto G_PUTCHAR;k 18:goto G_AND;k 19:goto G_OR;k 20:goto G_XOR;k 21:goto G_LSHIFT;k 22:goto G_RSHIFT;k 23:goto G_ILDA;\
k 24:goto G_ILDB;k 25:goto G_CAB;k 26:goto G_AB;k 27:goto G_BA;k 28:goto G_ALC;k 29:goto G_AHC;k 30:goto G_NOP;k 31:goto G_CBA;\
k 32:goto G_LLA;k 33:goto G_ILLDA;k 34:goto G_LLB;k 35:goto G_ILLDB;k 36:goto G_ILLDAA;k 37:goto G_ILLDBB;k 38:goto G_ILLDAB;k 39:goto G_ILLDBA;\
k 40:goto G_CA;k 41:goto G_CB;k 42:goto G_AC;k 43:goto G_BC;k 44:goto G_ISTA;k 45:goto G_ISTB;k 46:goto G_ISTLA;k 47:goto G_ISTLB;\
k 48:goto G_JMP;k 49:goto G_STLA;k 50:goto G_STLB;k 51:goto G_STC;k 52:goto G_PUSH;k 53:goto G_POP;k 54:goto G_PUSHA;k 55:goto G_POPA;\
k 56:goto G_ASTP;k 57:goto G_BSTP;k 58:goto G_COMPL;k 59:goto G_CPC;k 60:goto G_CALL;k 61:goto G_RET;k 62:goto G_FARILLDA;k 63:goto G_FARISTLA;\
k 64:goto G_FARILLDB;k 65:goto G_FARISTLB;k 66:goto G_FARPAGEL;k 67:goto G_FARPAGEST;k 68:goto G_LFARPC;k 69:goto G_FARCALL;k 70:goto G_FARRET;k 71:goto G_FARILDA;\
k 72:goto G_FARISTA;k 73:goto G_FARILDB;k 74:goto G_FARISTB;\
k 75:goto TB;k 76:goto TC;k 77:goto TD;k 78:goto TE;k 79:goto TF;\
k 80:goto U0;k 81:goto U1;k 82:goto U2;k 83:goto U3;k 84:goto U4;k 85:goto U5;k 86:goto U6;k 87:goto U7;\
k 88:goto U8;k 89:goto U9;k 90:goto UA;k 91:\
goto G_ALPUSH;k 92:goto G_BLPUSH;k 93:goto G_CPUSH;k 94:goto G_APUSH;k 95:goto G_BPUSH;\
k 96:goto G_ALPOP;k 97:goto G_BLPOP;k 98:goto G_CPOP;k 99:goto G_APOP;k 100:goto G_BPOP;\
k 101:goto G_INTERRUPT;k 102:goto G_CLOCK;\
k 103:goto G_ARX0;\
k 104:goto G_BRX0;k 105:goto V9;k 106:goto VA;k 107:goto VB;k 108:goto VC;k 109:goto VD;k 110:goto VE;k 111:goto VF;\
k 112:goto W0;k 113:goto W1;k 114:goto W2;k 115:goto W3;k 116:goto W4;k 117:goto W5;k 118:goto W6;k 119:goto W7;\
k 120:goto W8;k 121:goto W9;k 122:goto WA;k 123:goto WB;k 124:goto WC;k 125:goto WD;k 126:goto WE;\
k 127:goto WF;\
k 128:goto X0;k 129:goto X1;k 130:goto X2;k 131:goto X3;k 132:goto X4;\
k 133:goto X5;k 134:goto X6;k 135:goto X7;k 136:goto X8;k 137:goto X9;\
k 138:goto XA;k 139:goto XB;k 140:goto XC;k 141:goto XD;k 142:goto XE;k 143:goto XF;\
k 144:goto Y0;k 145:goto Y1;k 146:goto Y2;k 147:goto Y3;\
k 148:goto Y4;k 149:goto Y5;k 150:goto Y6;k 151:goto Y7;k 152:goto Y8;k 153:goto Y9;\
k 154:goto YA;k 155:goto YB;k 156:goto YC;k 157:goto YD;\
k 158:goto YE;k 159:goto YF;\
k 160:goto Z0;k 161:goto Z1;k 162:goto Z2;k 163:goto Z3;\
k 164:goto Z4;k 165:goto Z5;k 166:goto Z6;k 167:goto Z7;\
k 168:goto Z8;k 169:goto Z9;k 170:goto ZA;\
k 171:k 172:k 173:k 174:k 175:k 176:k 177:\
k 178:k 179:k 180:k 181:k 182:k 183:k 184:k 185:k 186:k 187:\
k 188:k 189:k 190:k 191:k 192:k 193:k 194:k 195:k 196:k 197:\
k 198:k 199:k 200:k 201:k 202:k 203:k 204:k 205:k 206:k 207:\
k 208:k 209:k 210:k 211:k 212:k 213:k 214:k 215:k 216:k 217:\
k 218:k 219:k 220:k 221:k 222:k 223:k 224:k 225:k 226:k 227:\
k 228:k 229:k 230:k 231:k 232:k 233:k 234:k 235:k 236:k 237:\
k 238:k 239:k 240:k 241:k 242:k 243:k 244:k 245:k 246:k 247:\
k 248:k 249:k 250:k 251:k 252:k 253:k 254:k 255:goto G_NOP;}
int e(){
register u program_counter_region=0;register U a=0,b=0,c=0,program_counter=0,stack_pointer=0;
register UU RX0=0,RX1=0,RX2=0,RX3=0;R=0;di();
G_NOP:D
G_HALT:dcl();return 0;
G_AND:a&=b;D
G_OR:a|=b;D
G_XOR:a^=b;D
G_GETCHAR:a=gch()D
G_PUTCHAR:pch(a)D
G_LSHIFT:a<<=b&15;D
G_RSHIFT:a>>=b&15;D
G_ILDA:a=r(c)D
G_ILDB:b=r(c)D
G_CAB:c=((a&255)<<8)+(b&255)D
G_AB:a=b;D
G_BA:b=a;D
G_ALC:a=c&0xff;D
G_AHC:a=(c>>8)&255;D
G_CBA:c=((b&255)<<8)+(a&255)D
G_LLA:a=CONSUME_TWO_BYTES;D
G_ILLDA:a=Z_READ_TWO_BYTES_THROUGH_C;D
I'm back with more ogvnokod!
0
IT Оффтоп #88
#58: https://govnokod.ru/26916 https://govnokod.xyz/_26916
#59: https://govnokod.ru/26934 https://govnokod.xyz/_26934
#60: https://govnokod.ru/26949 https://govnokod.xyz/_26949
#61: https://govnokod.ru/26980 https://govnokod.xyz/_26980
#62: https://govnokod.ru/26999 https://govnokod.xyz/_26999
#63: https://govnokod.ru/27004 https://govnokod.xyz/_27004
#64: https://govnokod.ru/27020 https://govnokod.xyz/_27020
#65: https://govnokod.ru/27027 https://govnokod.xyz/_27027
#66: https://govnokod.ru/27040 https://govnokod.xyz/_27040
#67: https://govnokod.ru/27049 https://govnokod.xyz/_27049
#68: https://govnokod.ru/27061 https://govnokod.xyz/_27061
#69: https://govnokod.ru/27071 https://govnokod.xyz/_27071
#70: https://govnokod.ru/27097 https://govnokod.xyz/_27097
#71: https://govnokod.ru/27115 https://govnokod.xyz/_27115
#72: https://govnokod.ru/27120 https://govnokod.xyz/_27120
#73: https://govnokod.ru/27136 https://govnokod.xyz/_27136
#74: https://govnokod.ru/27160 https://govnokod.xyz/_27160
#75: https://govnokod.ru/27166 https://govnokod.xyz/_27166
#76: https://govnokod.ru/27168 https://govnokod.xyz/_27168
#77: https://govnokod.ru/27186 https://govnokod.xyz/_27186
#78: https://govnokod.ru/27219 https://govnokod.xyz/_27219
#79: https://govnokod.ru/27254 https://govnokod.xyz/_27254
#80: https://govnokod.ru/27270 https://govnokod.xyz/_27270
#81: https://govnokod.ru/27280 https://govnokod.xyz/_27280
#82: https://govnokod.ru/27284 https://govnokod.xyz/_27284
#83: https://govnokod.ru/27296 https://govnokod.xyz/_27296
#84: https://govnokod.ru/27336 https://govnokod.xyz/_27336
#85: https://govnokod.ru/27381 https://govnokod.xyz/_27381
#86: https://govnokod.ru/27405 https://govnokod.xyz/_27405
#87: https://govnokod.ru/27429 https://govnokod.xyz/_27429
0
function main()
{
let a: [ name: string, age: number ];
a.name = "Test1";
print (a.name, " << end (should be value Test1)");
let b: [ name: string, age: number ] = [ "user", 10.0 ];
print (b.name, b.age);
let c: [ user: [ name: string, age: number ], type: number ] = [ [ "user2", 11.0 ], 1.0 ];
print (c.user.name, c.user.age, c.type);
print (c.user.name);
c.user.name = "Test2";
print (c.user.name, " << end (should be value Test2)");
}
Продолжаем будни говнокомпилятора. а ваш компилятор умеет делать проименнованные таплы (tuples)?