- 1
Internal error!
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
0
Internal error!
Save your work and restart IDE.
0
#include <iostream>
int main() {
std::cout << "Hello, shhhit!";
}
+1
#include <stdio.h>
#include <memory>
#define Property(type,name) type name;auto &set_##name(type val){name = val; return *this;}
#define Set(x,y) set_##x(y)
//#define Create(type, ...) (*(new type(__VA_ARGS__)))
template <typename T>
static inline T& Create_(const char *name)
{
return *(new T(name));
}
#define Create(type, ...) Create_<type>(__VA_ARGS__)
template <typename T>
static inline T CreateNoAlloc_(const char *name)
{
return T(name);
}
#define CreateNoAlloc(type, ...) CreateNoAlloc_<type>(__VA_ARGS__)
struct BaseItem
{
const char *Name;
BaseItem(const char *n): Name(n) {}
Property(int, Width);
Property(int, Height);
};
#include <vector>
struct Markup
{
std::vector<BaseItem*> Children;
template <typename T>
Markup &Add(T &item)
{
Children.push_back(&item);
return *this;
}
};
static inline Markup CreateMarkup(const char *n)
{
return Markup();
}
/*
struct Markup2
{
std::vector<std::shared_ptr<BaseItem>> Children;
template <typename T>
Markup2 &Add(T item)
{
Children.push_back(std::shared_ptr(&item));
return *this;
}
};
*/
template<std::size_t I = 0, typename... Tp>
inline typename std::enable_if<I == sizeof...(Tp), void>::type
print(std::tuple<Tp...>& t)
{ }
template<std::size_t I = 0, typename... Tp>
inline typename std::enable_if<I < sizeof...(Tp), void>::type
print(std::tuple<Tp...>& t)
{
printf("%s\n",std::get<I>(t).Name);
print<I + 1, Tp...>(t);
}
#include <string.h>
static BaseItem NOT_FOUND("NOT_FOUND");
template<typename T, std::size_t I = 0, typename... Tp>
inline typename std::enable_if<I == sizeof...(Tp), void>::type
print1(std::tuple<Tp...>& t, const char *n)
{ }
template<typename T, std::size_t I = 0, typename... Tp>
inline typename std::enable_if<I < sizeof...(Tp), T&>::type
print1(std::tuple<Tp...>& t, const char *n)
{
if( !strcmp(std::get<I>(t).Name, n))
return std::get<I>(t);
print1<T, I + 1, Tp...>(t,n);
return NOT_FOUND;
}
#define CreateMarkup(...) std::make_tuple(__VA_ARGS__)
#define AppendMarkup(src, ...) std::tuple_cat(src, std::make_tuple(__VA_ARGS__))
#define MarkupItem(markup,type,name,action) namespace {type &i = print1<type>(markup,name).action; }
auto markup1 = CreateMarkup(BaseItem("test").Set(Width,14), BaseItem("test2"));
auto markup2 = AppendMarkup(markup1,BaseItem("test3").Set(Width,15));
auto markup3 = markup1;
MarkupItem(markup3,BaseItem,"test2",Set(Width,16));
template <typename T>
Т.к юзается препроцессор, запощу в C
+1
function main() {
let c = 0;
try {
c++;
print("try");
throw "except";
c--;
print("after catch");
} finally {
c++;
print("finally");
}
assert(2 == c);
}
ну вот и все... проимплементил последний keyword в языке... (осталось только темплейты - ну и головняк меня ждем)
0
// этот код дает Segment Fault
struct TypeNames
{
std::string typeName;
};
class LLVMRTTIHelperVCLinux
{
SmallVector<TypeNames> types;
}
// a этот нет
class LLVMRTTIHelperVCLinux
{
SmallVector<std::string> types;
}
ну и гавно этот ваш Clang. MSVC работает, GCС работает а Clang нет
−1
Здесь будут опубликованы пароли от учётных записей
+1
Ой, девачьки, я 5 лет не заходило. Почему нет говнокодов на Дульфи? Я десять страниц промотал! Неужели все дульфисты впали
в старческий маразм и не могут больше срать на этом недоязыке? Почему? Он же изначально создавался для даунов.
Что стало с Тарасом? Что стало с поняшей-ассемблеристом?
Только одфаги меня вспомнят.
+1
alex@ASD-PC:~/TypeScriptCompiler/3rdParty/llvm-wasm/debug/bin$ node mlir-translate.js --help
OVERVIEW: MLIR Translation Testing Tool
USAGE: mlir-translate.js [options] <input file>
OPTIONS:
Color Options:
--color - Use colors in output (default=autodetect)
General options:
--dot-cfg-mssa=<file name for generated dot file> - file name for generated dot file
--mlir-disable-threading - Disabling multi-threading within MLIR
--mlir-elide-elementsattrs-if-larger=<uint> - Elide ElementsAttrs with "..." that have more elements than the given upper limit
--mlir-pretty-debuginfo - Print pretty debug info in MLIR output
--mlir-print-debuginfo - Print debug info in MLIR output
--mlir-print-elementsattrs-with-hex-if-larger=<long> - Print DenseElementsAttrs with a hex string that have more elements than the given upper limit (use -1 to disable)
--mlir-print-op-on-diagnostic - When a diagnostic is emitted on an operation, also print the operation as an attached note
--mlir-print-stacktrace-on-diagnostic - When a diagnostic is emitted, also print the stack trace as an attached note
-o=<filename> - Output filename
--split-input-file - Split the input file into pieces and process each chunk independently
Translation to perform
--deserialize-spirv - deserialize-spirv
--import-llvm - import-llvm
--mlir-to-llvmir - mlir-to-llvmir
--serialize-spirv - serialize-spirv
--test-spirv-roundtrip - test-spirv-roundtrip
--test-spirv-roundtrip-debug - test-spirv-roundtrip-debug
--verify-diagnostics - Check that emitted diagnostics match expected-* lines on the corresponding line
Generic Options:
--help - Display available options (--help-hidden for more)
--help-list - Display list of available options (--help-list-hidden for more)
--version - Display the version of this program
program exited (with status: 0), but EXIT_RUNTIME is not set, so halting execution but not exiting the runtime or preventing further async execution (build with EXIT_RUNTIME=1, if you want a true shutdown)
alex@ASD-PC:~/TypeScriptCompiler/3rdParty/llvm-wasm/debug/bin$
сказ о том как я LLVM на WASM компилял :)
−2
function throw_artefact(obj)
if obj==nil then
return
end
math.randomseed(time_global())
local rnd=math.random(10)
local sect = obj:section()
local lv = obj:level_vertex_id()
local gv = obj:game_vertex_id()
local pos = obj:position()
local off_x = 2
local off_y = 1.5
local off_z = 2
pos.x = pos.x + off_x
pos.y = pos.y + off_y
pos.z = pos.z + off_z
if lv and gv and pos then
math.randomseed(time_global())
if string.find(sect, "witches") then
if string.find(sect, "weak") then
math.randomseed(time_global())
if math.random(4) == 1 then alife():create("af_electra_sparkler", pos, lv, gv) end
elseif string.find(sect, "average") then
math.randomseed(time_global())
if math.random(6) == 1 then alife():create("af_electra_sparkler", pos, lv, gv) end
if math.random(4) == 1 then alife():create("af_electra_flash", pos, lv, gv) end
else
math.randomseed(time_global())
if math.random(4) == 1 then alife():create("af_electra_moonlight", pos, lv, gv) end
if math.random(5) == 1 then alife():create("af_electra_flash", pos, lv, gv) end
if math.random(5) == 1 then alife():create("af_electra_sparkler", pos, lv, gv) end
end
elseif string.find(sect, "mosquito") then
math.randomseed(time_global())
if string.find(sect, "weak") then
if math.random(6) == 1 then alife():create("af_cristall_flower", pos, lv, gv) end
elseif string.find(sect, "average") then
if math.random(4) == 1 then alife():create("af_cristall_flower", pos, lv, gv) end
if math.random(5) == 1 then alife():create("af_medusa", pos, lv, gv) end
else
if math.random(6) == 1 then alife():create("af_night_star", pos, lv, gv) end
if math.random(4) == 1 then alife():create("af_medusa", pos, lv, gv) end
if math.random(5) == 1 then alife():create("af_cristall_flower", pos, lv, gv) end
end
elseif string.find(sect, "mincer") then
math.randomseed(time_global())
if string.find(sect, "weak") then
if math.random(6)==1 then alife():create("af_blood", pos, lv, gv) end
elseif string.find(sect, "average") then
if math.random(5) == 1 then alife():create("af_blood", pos, lv, gv) end
if math.random(4) <= 1 then alife():create("af_mincer_meat", pos, lv, gv) end
else
if math.random(6) == 1 then alife():create("af_soul", pos, lv, gv) end
if math.random(4) == 1 then alife():create("af_mincer_meat", pos, lv, gv) end
if math.random(5) == 1 then alife():create("af_blood", pos, lv, gv) end
end
elseif string.find(sect, "gravi") then
math.randomseed(time_global())
if string.find(sect, "weak") then
if math.random(6)==1 then alife():create("af_vyvert", pos, lv, gv) end
elseif string.find(sect, "average") then
if math.random(4) == 1 then alife():create("af_vyvert", pos, lv, gv) end
if math.random(5) <= 1 then alife():create("af_gravi", pos, lv, gv) end
else
if math.random(6) == 1 then alife():create("af_gold_fish", pos, lv, gv) end
if math.random(4) == 1 then alife():create("af_gravi", pos, lv, gv) end
if math.random(5) == 1 then alife():create("af_vyvert", pos, lv, gv) end
end
elseif string.find(sect, "ameba") or string.find(sect, "burning_fuzz") or string.find(sect, "rusty") then
math.randomseed(time_global())
if math.random(2) == 1 then alife():create("af_rusty_sea-urchin", pos, lv, gv) end
if math.random(2) == 1 then alife():create("af_rusty_kristall", pos, lv, gv) end
if math.random(2) == 1 then alife():create("af_rusty_thorn", pos, lv, gv) end
elseif string.find(sect, "buzz") then
if string.find(sect, "weak") then
if math.random(6)==1 then alife():create("af_ameba_slug", pos, lv, gv) end
elseif string.find(sect, "average") then
if math.random(5) == 1 then alife():create("af_ameba_slime", pos, lv, gv) end
if math.random(4) <= 1 then alife():create("af_ameba_slug", pos, lv, gv) end
else
if math.random(5) == 1 then alife():create("af_ameba_mica", pos, lv, gv) end
if math.random(5) == 1 then alife():create("af_ameba_slug", pos, lv, gv) end
if math.random(4) == 1 then alife():create("af_ameba_slime", pos, lv, gv) end
end
elseif string.find(sect, "doggy") then
local n=0
math.randomseed(time_global())
for n=1, math.random(3) do
alife():create("dog_weak", pos, lv, gv)
end
Свиток перебирает аномалии на локации и по рандому спавнит в них артефакты.
Да, блять - мне пришлось изучить луа. Теперь я тоже "золотой хуй".
Нижние строки отвечают за функционирование самодельной аномалии, которая после полуночи (по ИВ) плодит гипнособак и прочую нечисть. Стаи собак вырезают целые поселения; таким образом, я стал поистине сталкером. Так как я давно фриплею, надо разнообразить ко-ко-корутину.
0
IT Оффтоп #118
#88: https://govnokod.ru/27432 https://govnokod.xyz/_27432
#89: https://govnokod.ru/27435 https://govnokod.xyz/_27435
#90: https://govnokod.ru/27439 https://govnokod.xyz/_27439
#91: https://govnokod.ru/27449 https://govnokod.xyz/_27449
#92: https://govnokod.ru/27460 https://govnokod.xyz/_27460
#93: https://govnokod.ru/27463 https://govnokod.xyz/_27463
#94: https://govnokod.ru/27466 https://govnokod.xyz/_27466
#95: https://govnokod.ru/27473 https://govnokod.xyz/_27473
#96: https://govnokod.ru/27478 https://govnokod.xyz/_27478
#97: https://govnokod.ru/27484 https://govnokod.xyz/_27484
#98: https://govnokod.ru/27495 https://govnokod.xyz/_27495
#99: https://govnokod.ru/27504 https://govnokod.xyz/_27504
#100: https://govnokod.ru/27508 https://govnokod.xyz/_27508
#101: https://govnokod.ru/27511 https://govnokod.xyz/_27511
#102: https://govnokod.ru/27518 https://govnokod.xyz/_27518
#103: https://govnokod.ru/27526 https://govnokod.xyz/_27526
#104: https://govnokod.ru/27534 https://govnokod.xyz/_27534
#105: https://govnokod.ru/27544 https://govnokod.xyz/_27544
#106: https://govnokod.ru/27552 https://govnokod.xyz/_27552
#107: https://govnokod.ru/27554 https://govnokod.xyz/_27554
#108: https://govnokod.ru/27557 https://govnokod.xyz/_27557
#109: https://govnokod.ru/27581 https://govnokod.xyz/_27581
#110: https://govnokod.ru/27610 https://govnokod.xyz/_27610
#111: https://govnokod.ru/27644 https://govnokod.xyz/_27644
#112: https://govnokod.ru/27648 https://govnokod.xyz/_27648
#113: https://govnokod.ru/27652 https://govnokod.xyz/_27652
#114: https://govnokod.ru/27659 https://govnokod.xyz/_27659
#115: https://govnokod.ru/27665 https://govnokod.xyz/_27665
#116: https://govnokod.ru/27671 https://govnokod.xyz/_27671
#117: https://govnokod.ru/27675 https://govnokod.xyz/_27675