#code-talk
2 messages Β· Page 25 of 1
https://pastebin.com/AiqEAidL is a multithreaded test code that I wrote a while ago and it just works by passing the second value as your number of threads, and it is quite interesting how you can get different speeds depending on the number of threads - they aren't linear speeds by any chance
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
these are the test results I got for speed, though I think what affected results the most was dividing the unsigned long int by the number of threads on line 17
dividing by 3 gave the worst performance from everything .. though it is good to note, this was done on ARM7v71 with 1200Mhz and 4c/4t, it is interesting that it had 9 seconds of run time for both 4 threads and 8 threads and I have not been able to replicate that at any other number of threads
Their FPU is integral to the CPU core in armv6hf onwards. Compulsory in all A profile ARMv7 implementations (optional in M profile, I'll admit I dont know about R) and all ARMv8 cores regardless of profile
Very little functional difference between how ARM and x86 handle floating point or any other math. Only major difference is the more widespread adoption of SIMD operations in x86, 128 bit wide SIMD is present in ARMv8 but modern intel and AMD both have 256 bit wide and intel also have some cores with 512 bit wide
would it be hard to make a fpu bitcoin miner ?
well floating point math can be done on the general purpose registers, it's just that it's more precise and faster to calculate in the FPU which is what I am trying to get at
for example, AVR has no fancy FPU at all, and it can certainly calculate floating point
i like arduino
yeah arduino is like python, it runs horribly slow
dont tell me that
you need to use Atmel Studio to get the most of AVR
damn u puritans
well, the studio isn't what makes it, I mean, you could write your own compiler for AVR but it would be a waste of time
are you saying the compiling is slow or the result ?
well arduino is a framework, like a runtime for your programs
i thought it was just an editor & bootloader
whether you use libraries in it or not, anything you compile in it will rely on the arduino framework when it runs
yeah the bootloader is essentially like the runtime
when you program AVR in avr-asm and upload it with an Atmel programmer, it will not use a bootloader, it will run natively
you can use arduino bootloader in atmel studio as well
when I started using avr-asm I stopped using arduino for it entirely and focused on doing everything in assembly to further expand my capability
some of the chips don't even have a multiply or divide instruction so you have to make a function to do that
but here's the thing, time, for me the time saved using arduino and all its available libraries is worth way more than any performance difference on a 8Mhz chip...
well with something like the attiny10, you can only fit tiny programs on it, and you probably may never need to divide numbers on it
it has add, subtract but no multiply or divide instruction
sure, but think about all the modules that make arduino so good, having to write your own 'drivers' for them
yeah it is a pain to deal with i2c modules in assembly because you have to write all the functions to handle the serial communication
but once you make what you need for the basics of data transfer, you can do way more than arduino can do since you can choose when to send a bit and whatnot
i think sure, say you had a big project that you needed every little bit of performance and it was going to sell a million units, go atmel/assembly, but generally im just tinkering for myself so quicker the better as hhalf my projects never get finished
yeah the performance is better but also the thing is that if you wanted to send custom messages via serial, it is much harder to do in arduino compared to at the assembly level
how custom, ? i can send bits or bytes via serial
timing is a big deal for serial comms as well
baud rate ?
so if arduino's code happens to run too slow for something that requires precise timing, that can cause issues
separately from baud rate, there are things like buffer registers for example
when data comes in or goes out, you have to read or write it from a buffer register, then deal with that data in a timely manner before another message is sent or received
ive wondered about this, can a serial input fill up if you dont read from it ?
I have to read up on it, but I think it said in the protocol that it blocks until the buffer is cleared
so , the sender would get some kind of fail event ?
the same thing happens with computers when too many connections start but then never acknowledge, filling up socket queue/buffers and then this causes denial of service, since all the queue slots are filled
so to fix a basic denial of service with a socket queue, you have to basically make a timeout function that measures the time a connection to the socket started, and if the 3 way handshake is not completed in a timely fashion, you should close() the connection to free up a spot in the queue
in serial communication, you can have the same issue theoretically because of the data buffer
well in i2c, parity is very simple, so it just wouldn't send an acknowledge back to the sender if the buffer blocked
not profitable because of electricity costs. need specialized hardware
well ideally for bitcoin, there should be dedicated math coprocessors, and those used to be a thing at one time in history
its more like just the circuitry for calculating the hash
generally modern processors are beasts with floating point calculations, but always memory access is a throttle. same on the GPUs
but they do it with asic
this is why everybody tries to turn everything into matrix math because they know how to optimize those calculations for good memory access
so the compute power is there, but its not worth the cost in energy
it is kind of sad that most software will never utilize all of the FPU
its really hard
like for me, I don't have AVX-512 support nor AVX2, but I'll probably never need it because nothing uses it
and there's just a handful of games now that require AVX1
games requiring cpu features? whyy
surely some library theyre using a static binary of
they're using AVX for better game performance
it comes down to what I was saying before, you can calculate floating numbers in any cpu register, but if you use the specialized FPU registers or the special math extensions, you will have significantly better performance and higher accuracy
however, the software has to support using those extensions
you can't use an if statement in this case, because it's machine code level, you'd have to make a separate version of your game for non-AVX, AVX2, and AVX-512 so you'd need 3 different compiled versions if you were going to offer people a choice of which one to support - or you could pick one that most people can use - most software probably out of worries of userbase just simply don't use any of them ... it is kind of like when we used to have x86, amd64, Itanium2, VAX, Alpha, DEC and all these different architectures with various instruction sets ... now most of the computer world is amd64 (now referred to as x86-64 or x64 as AMD and Intel decided to come to one standard)
good example of why compilers can be bad compared to handwritten assembly
the source code for both along with the commands you need to use to compile/assemble them are here https://pastebin.com/nAD86vJP
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
for the assembler, I just used nasm and for linking I used Link.exe from MSVC Tools 14.29.30037 and libraries were in the Windows Kit 10.0.20348.0 (both you have to install as components in visual studio)
if you want to make it into a DLL instead of executable you can change the linker command to <path-to-link.exe> factorial.obj /dll /export:factorial /nologo /incremental:no /opt:ref /OUT:factorial.dll /MACHINE:X64 <libraries> and then you can call int factorial(int) from another program using the DLL written in assembly
so allan why do you use windows if youre so anti microsoft? why arent you on linux or something?
gamer reasons?
not so much anti-microsoft but rather anti-.NET/CIL
the sole purpose of .NET/CIL was to make you buy a new dev kit every year and force the old one to expire
i have never paid a dollar for anything .net
its open source... MIT license
the dev environments are either free or open source
you can use all of the .NET libraries from GCC anyway, but at the same time, they are terribly slow and inefficient
but you complain about microsoft compilers and stuff
yes because MS switched everything over to CIL
yea let me just use that web server library 
good luck finding one as fast as whats made in .net
you just hate one particular set of libraries and runtimes... thats weird
most people who dont like .net dont like it because microsoft and thats basically their only reason
they were originally made long ago to help bring more people into programming because their purpose was to make programming easier and more understandable - but then it morphed into mainstream production when it should have remained as educational
thats not correct
same with python, it was originally made for simple scripts to compete with shell scripts, it was never supposed to be mainstream
it was always meant for production, never for education...
you are incorrect about many things .net, which i imagine is because you havent actually used it
if you compare VB 6.0 and VB .NET you can clearly see why they made .NET
.net is not vb
and VB 6.0 will be used in eternity, I can bet in 20 years I will still see VB 6.0
i see how making vb.net made basic easier. .net has nothing to do with making programming easier
it does simplify some old terrible interfaces, e.g. COM
well when I say .NET I am referring to CIL
thats just incidental stuff - people learn better ways to make things on their second try
VB 6.0 was the last real compiler microsoft ever made, everything after that compiles to CIL instead of assembly/machine code
this is nonsense
have you looked at any of your compiled programs in hex editor yet
you spend too much time with your head in a hex editor
im aware of what the IL looks like
i dont really care why you dont like .net, i was just curious why you run windows
linux is equally guilty of copying microsoft by making everything use clang/llvm
so far it's not bad, as long as they don't suddenly decide to force everyone to use it like a runtime
you truly are in last century's computer science
youre gonna get left behind, allan
llvm is pretty damn sweet
also im sure youve used linux, but as your main OS i think youd like it
I'll go to the niche area of fixing things people can't fix at the low level
I'll be honest windows does things better, just that I think MS is making bad moves and trying to be too greedy
but a user does not have much control in windows
and is this really true
you can do a lot to secure windows, it's just a lot of extra work
no im not talking about security. i dont think windows has security problems. and it sure is fast
if linux wanted to make the desktop market, Linus should have worked on X himself instead of getting the community to make it
its way too much to ask 1 person to work on
its difficult to commercialize because of the license, so i dont think itll be a common desktop OS in my life
but for a programmer...
unless you make games, most programmers are developing for linux now
even Linus now admits the GPL was a mistake, he wishes he could have gone back and done things differently
was it not copyleft enough for him?
the idea was to allow future development, not to make the software for free as in penniless
the problem is that if you give out source code to allow future development, someone is going to steal it and say they made it, or they can compile it and sell it to undercut you, and now you need to litigate it to make any profit from it, and in the end, a country that does not have intellectual property laws will just actively steal it and distribute it
if you give out source code, people use it (not steal), and they dont need to claim credit because you gave it away
a lot of money is made supporting software, not just writing it
jesus look how much money redhat brings in
its like theres more money in harry potter merchandise than the book advances probably
@fickle aurorahow hard to make crypto minor ? why fpga not suitable compared with asic ?
it can probably be done, but how efficient would that be compared to a xeon with plenty of L3 cache, cores and fairly high clock speed
xeon is shit
this sort of thing https://shop.bitmain.com/
View Bitmain's Range Of Asic Bitcoin Miners And Buy Online With Bitcoin
I'm using a 2013-era xeon to play star citizen and I outperform some brand new builds lol
it is hilarious how bad new CPU models are now
of course, if you can get a new CPU with the same or better stats than the older xeons, then you will certainly get better performance
oh that is based on power vs cost efficiency
yeah I can see why xeon would be bad for mining crypto
asic miners are like 12-70k$ right now
but only because they are pegged againts crypto price and roi
has anyone considered completely changing the software side to run faster in a single process and then use single core with highest clock speed possible, with efficient cooling
not sure but @fickle aurora would be the guy that knows the most about low level efficiency π
I mean multithreading is good, but 4 cars against a single car with a faster engine will not get to the finish line faster
would they not have the same combined work output ?
so it's only an advantage if you can do future calculations and combine them
but cant the 4 jobs just run in parralel until complete
yes, assuming that you can do that
some time as running 4 jobs one after other at 4x speed
sometimes you need to go in sequence
true
you cannot, because its hashes
cannot what ?
its all intentionally slow
if the calculations must be done sequentially, then multithreading is useless
isnt it just randomly generating numbers ?
you can still multithread but the hashing algorithm is sequential
you could however run multiple separate calculations
yea it can scale with CPU
then you're better off with a board that supports multiple single core cpus with highest possible clock speed and cache
but the ASICs are orders of magnitude faster at the specific operations
and it doesnt need any floating point
yeah you would need like 500 cpu, just guessing number
the problem with multicore is that you can't overclock too much due to heat
bitcoin mining doesnt use like 99% of the CPUs features
i feel like fpga might be best approach as you can make ur own circuit so there is room for innovation
and instead of RAM you just need cache which is essentially SRAM
you dont really need innovation as you know the algorithm
cache is not helpful, you cant build rainbow tables
its all just hard integer calculations
so you just need the clock speed
you cant get high enough speed out of generalized processors
but could you design a fpga that could perform on par with a asic but fro cheaper
i cant remember the btc exact specs, but im guessing its all pivoted around a modulo, because division is generally the mathematical trap door
as its not inflated price to peg againts btc price
but you wouldnt need to - the algorithm doesnt change, and the asics are cheaper to manufacture at bulk
but making asic not possible by me , but i can make fpga ?
right but if you were doing this at large scale to really make money, youd make an asic
you know 3d printing vs molds
youd likely make more money from reselling asics than mining
but problem is getting it made
hah in the california gold rush, a chicken cost as much as an ounce of gold
you might make more money automating farm equipment
yea sometimes the support industry is bigger...
there are still farmers paying people 20 bucks an hour to shovel out barns
and then there's IBM hiring masses to produce the stuff that the farmer has to shovel
the only reason IBM is still in existence is the endless government contracts that happily go overbudget and have to be scrapped and reworked constantly because of obvious security holes, the wrong order of starbucks coffee, and things like the wonderful world of java
C surely has contributed more security exploits than any other language
i mean obviously actionscript/flash but ...
when they did the Shared Services system for the canadian government, it was a total disaster and now CRA is shut down because of it
I wonder if they filter user input in web text boxes
shard 1 dead
Found this some time ago: https://www.nandland.com/articles/using-your-fpga-to-mine-for-bitcoins.html
Why using your FPGA development board to mine for bitcoins is a bad idea. Why you can not make money by bitcoin hunting.
I think it is about 3 years old.
thanks
so if you somehow think you can do it better thhan anyone else you might as well do it in software on your home computer first
I was thinking about btc mining some years ago but it is to expensive in germany. There are options for cloud mining (some are scam!) where you virtually rent the MH. I'm personally not very much into crypto. Thought about buying rather than mining.
yeah Australia electricity price is really too high too
this in going to be a bit of a problem thhough
foxhole needs to be in VR
yeah I wouldn't rent a server for mining, because you will get a virtual private server in a VM environment with hundreds of other virtual servers on the same machine and they will throttle your server
a lot of dedicated server co's are con artists, my raspberry pi had more computing power than the VPS that some of them were offering
https://pastebin.com/K9ri3Tx3 another example, 32 bit this time and instead of calling printf, it calls WriteFile and writes to STDOUT which is essentially what printf is, just a wrapper function that uses WriteFile (we can't save space here because we are stuck with using ucrt,lib, vcruntime.lib, msvcrt.lib, and kernel32.Lib as the minimum things we need to link to)
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
re: the bitcoin mining, i think if you can do renewable energy and you have low maintenance costs then it can still be viable to mine
but not if youre replacing parts or generators or solar panels often enough to eat into your cost
Australia would be suitable for solar powered mining but I think getting all the stuff needed is quite expensive there. Most miners are operating from countries rich in natural resources for energy production like China (coal and nuclear), followed by Russia/India (coal and nuclear too) and Iceland (hot vulcanic geothermal energie).
@fickle aurora You are not renting a vps server for mining. You rent calculation time on asics: https://shamining.com based on what you pay you get more power.
until we get quantum computers
sounds fair, but remember if they are selling you a service, they are in it for profit for themselves
Yes of course!
This is what everyone is looking for.
@long raft At least you can try that for free. You can model the crypto algorithm with gates: https://quantum-computing.ibm.com/composer/files/new But you can't use the result, it is an isolated process without blockchain access.
That is not an emulator! These are real quantum computer. Just register, write your code and wait for execution time!
made a fully windowed app in 64-bit assembly, only uses 1kb of memory compared to the 30MB+ you would get from .net framework
I think I will go back to using C, populating stack manually is too much work π most of the info online is all for 32 bit which is incompatible, and the x64 calling convention is significantly different from the x86 one ... but not a bad thing to learn
https://pastebin.com/eabZAC27 instructions for assembling and linking are in the paste header
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Hi all, the Wiki lacks stats for the previous war WC85 nobody happens to have data on the deaths for that war end do they?
any Frontend or backend developers with web development experience? Interested in setting up a logistics portal as some of the tools out there are either regiment specific and authenticated for them only or are not very user friendly.
@hollow gyro my site does
I don't see them exposed for previous wars.
Could you update WC85 Deaths on: https://foxhole.fandom.com/wiki/World_Conquest
World Conquest is the main game mode of Foxhole. In it, all of the game's regions are fought on simultaneously, and connected to each other. One town in each active region is a "Victory Condition" town, indicated by the symbol - . In order to win, a faction must control and upgrade a certain number of Victory Condition towns with the Provisiona...
Updated it @hollow gyro
Do we have activity logs like the new stats available on the war api yet or do you guys think they wonβt add them?
so much for garbage collection, windows is using 13GB of memory and nothing intensive is even running
How much RAM does your build have
Coz windows is kinda famous for "if you give me more RAM I will use more RAM"
Then again judging by the chat history you probably know more about this than I do so I'mma just
I have a lot of ram, it's very minor, but garbage collection is still a bad concept imo
garbage collection has many advantages
also this idea that youre only doing small things why is windows using so much ram? its the cache. and it improves your performance.
why spend money on ram and then not use it?
true, it's caching 45GB of mem
Negative
darn:(
Windows using 13gb is definitely cache
And most of it will free up if another process needs it
I have 20gb of ram and windows only uses about 3gb (windows 10's ram requirement is 4gb mind you)
and garbage collected memory takes less space because it defragments it
which could also mean less page faults
it actually says it's using 44.5GB cached and 13.6GB in use
How do you even use so many ram?
probably just disk cache
Huh
well theres no reason to unload it
i mean in theory all the data passing through the disk could jsut be cached. i mean thats how i live on zfs. all the ram.
just chillin in volatile memory, catchin cosmic rays
page files are all completely disabled
I just love to torture my PC π
I'm surprised the Fozhole War API is not pinned in this channel.
well the first pin has the link to the API https://github.com/clapfoot/warapi
Try Rust. Its basically a better C/C++. No Garbage Collectors
Yes and my point is that your statement was false as arm does possess a true hardware FPU
Also your description of how arduino operates was fundamentally incorrect
It actually uses avr-gcc and is not a runtime at all, its nothing but a library of helpers, its otherwise raw C++ in avr-gcc, much like atmel studio uses
well AVR does not have any FPU and it's not based on ARM ... ARM and AVR are 2 totally different architectures ... also, A32 instruction set for some of ARM cpus do not have an FPU ... AVR is the architecture of atmel microcontrollers, ARM is a whole different platform ... there is also PIC which is another architecture
but you can store a binary version of float in general registers, but it is perhaps a bad idea since the general registers have no method of setting the decimal point, so you would have to store that in another register as a modifier - but you could theoretically do it
and yes arduino is a framework (notice that arduino calls them sketches and not programs?) and you have to link to arduino's libraries, which in turn includes the framework in your binary
not been used in about a decade mate
ARMv6hf has FPU. ARMv7 A profile its compulsory. ARMv8 it is compulsory on all profiles
Never mentioned AVR
you did
Well aware AVR is something else entirely but I never mentioned AVR outside the context of a basic arduino (though not all arduinos are AVR either, nor are all atmels AVR). Nor did I ever mention floating point in the context of an AVR or arduino
But you did state arduino to be a runtime, which it is not
ARduino for non avr targets of course doesnt use AVR-gcc, though generally uses gcc backends where possible
Only real exception are a small handful of arm targets for arduino are technically threads within mbedOS so use the mbedOS toolchains under the hood, themselves often using gcc - there you're getting closer to a runtime
so you are saying if I compile this code https://pastebin.com/3y9uLABe in atmel studio using avr-gcc that it will compile? (this is the blink example from arduino's examples) without trying, I know it won't compile, because the first thing it will do is that it will say there's no main() function ... of course, arduino likely uses a wrapper (I haven't been bothered to read their source code), but even then, it's introducing bloat - because as we know calling functions adds overhead due to needing to push variables onto the stack, then saving the current instruction pointer, then going into the function, popping them back off the stack to work with, eventually returning a value, of course more pushing and popping instructions - all when you could have just done most of it in main()
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
/*
main.cpp - Main loop for Arduino sketches
Copyright (c) 2005-2013 Arduino Team. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <Arduino.h>
// Declared weak in Arduino.h to allow user redefinitions.
int atexit(void (* /*func*/ )()) { return 0; }
// Weak empty variant initialization function.
// May be redefined by variant files.
void initVariant() __attribute__((weak));
void initVariant() { }
void setupUSB() __attribute__((weak));
void setupUSB() { }
int main(void)
{
init();
initVariant();
#if defined(USBCON)
USBDevice.attach();
#endif
setup();
for (;;) {
loop();
if (serialEventRun) serialEventRun();
}
return 0;
}
https://pastebin.com/SpyGzaY0 so here is my comparison of using Arduino for blinking the LED on pin 13 to making the same function in Atmel Studio with AVR-GCC ... the difference is that the minimum size (without bootloader) that arduino could produce is a 2.55kB hex file and I could produce a 418 byte hex file. Of course, I could have saved even more by making it in assembly
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
if you really want, you can even observe the build window in arduino and see the gcc invokations. But apparently you're more interested in strawmanning and goalpost shifting
arduino's hex file was 3.83kB with the bootloader attached
I'm just giving facts, you can compile it and see what it does
No, you're not. You're moving the goalposts having been proven factually wrong about previous statements
the extra 2132 bytes that arduino adds to an otherwise 418 byte hex file is basically the whole arduino library, even if you don't need it, and it runs through hundreds of extra code that you don't need ... we call it bloatware in programming
Except it doesnt run through it all
2048 bytes are the bootloader, most of those bytes are actually nulled
the hex file is literally the machine code that it will run through
the chip has to run the entire hex file
It actually doesnt, you are well aware yourself you can jump about
bootloader sector is 2k, so bootloader is 2k but not filled. First executable byte is address 2048
They dont pull any tricks compressing the hex
without bootloader, arduino's hex file was still 2.55kB
And not all executed as by default optimisation isnt enabled
so libs will be pulled in, but never executed
You can forcibly alter the optimisation level if you wish
Most of the arduino standard lib is incredibly inoptimal versus direct register manipulation. but I never argued that point, and neither did you originally until your previous point about arduino being a runtime was proven otherwise.
Doesn't mean arduino is bad. Its specifically designed to be accessible
Equally I wouldnt go and implement the firmware for some mass produced medical device in it
it isn't legal to use 328p in medical equipment anyway
if you do, you break atmel's license agreement in the first place because of the legal agreement you agree to states it must not be used for medical equipment
you can use anything in medical equipment, you just gotta prove/certify it. 328 just isnt precertified
arduino is also considered a runtime library afaik according to the wikipedia definition, since it's not only a program library, it literally makes a whole user-friendly interface so you don't have to do things like clear the buffer every time you want to send/receive serial data, adding debugging symbols everywhere, validation of logic and data, and handling the directives to the chip for you, such as setting IO configuration
my bad, the 328p is allowed in automobiles according to spec, but there are some other models that I ordered that explicitly prohibited its use in automobiles - and only some chips are licensed for medical equipment - you can't just use any chip there
also, optimization has nothing to do with anything other than how the compiler will convert your code into machine code, for example, if you declare a variable but it seems like it is not used in your program, the compiler will omit it - sometimes you need that variable in there, so you use the volatile keyword to prevent the compiler from removing it ... sometimes optimization even makes the end result worse, such as -O3, in some cases that will actually give you worse optimization than -O2, but you have to know how the compiler will convert your source code to understand this
That isnt what volatile does. But you've already tried badly misexplaining enough
volatile is literally a keyword that tells the compiler "do not optimize this"
Code removal is performed as an optimisation pass, with it all disabled, yes, it will emit unused code frequently
and no, that isnt what volatile does
Here is another reference taken from the book written by the guys who invented the C language, Brian Kernighan and Dennis Ritchie, ISBN number 0-13-110362-8 page 211 states that volatile keyword prevents compiler optimizations
stand corrected
it's all good we're here to learn
you can still use optimizations but none that mess with threading
its just a cache issue
i havent seen volatile used in 20+ years
like union, lol, when disk mentioned using one the other day i wasnt even sure the context
oh jesus remember when people used to inline everything?
god i used to think i was so clever inlining functions i cared about performance
aye when thats one of the most basic optimisations going so most compilers have a decent implementation for doing
so common that some JIT's even do it automatically
Its present as a decorator in .net
c# has inline?? 
Implemented differently
time to refactor all my code
but yes, its not super useful
i dont care about memory i just want speeeeeeed
Nah, modern roslyn is quite good at performance counting method hits and inlining at runtime on hot paths
Some benches, faster
using System;
using System.Globalization;
using System.Runtime.CompilerServices;
public class Utility
{
[MethodImplAttribute(MethodImplOptions.NoInlining)]
public static string GetCalendarName(Calendar cal)
{
return cal.ToString().Replace("System.Globalization.", "").
Replace("Calendar", "");
}
}
or replace NoInlining with AggressiveInlining
https://pastebin.com/fM8EATg7 this is a very good example code to learn how volatile keyword works. I suggest trying it out, you will really like my example. You have to compile with -O2 optimization flag and try it out, then add volatile keyword to line 45 and then recompile and try again to see how it works
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
and while you say you havent seen it in 20 years, well, here is a modern example that is still relevant
its a 10 line program, what about that is modern?
like where would it come up?
like instead of deoptimizing my program and second guessing my CPU i woudl rather use proper thread safety mechanisms
well you are programming in C#, it's a whole different language
my example is valid for C and C++ - specifically for GCC compiler
i know its valid but people still wouldnt do it that way now
theyd use a proper semaphore or better suited mechanism than skipping optimizations
I see the volatile keyword used all the time
yes it's used in libraries all over the linux platform, which you suggest that I use :D
the linux platform is a lot of old code
god knows their record on thread safety is rough
yeah it's probably really bad considering the top 500 servers in the world run that old code
C and C++ will always exist, while python will die a horrible death
you know there were decades before C existed, right?
it wasnt like the first on the scene
Except python is meant to serve a totally different role to C
meanwhile, even torvalds admits most of the code in linux sucks
yes everything around it died out but C and C++ have carried on
its well tested, i wouldnt want to rewrite it, but its not very good C
python has anything but died out
COBOL is still very much alive
well cobol is more similar to assembly
Hell, we've even got efforts underway to improve the linux codebase, by sticking rust in it
yea i dont think id go back to C id probably learn rust if i had to work low level again
these days if you want to get into anything useful, C++ is the way forward
forward to ... what? writing games?
I will admit, ANSI C is not great, and most of what I do is a combination of C and C++ which is why I often default to calling it C/C++
i have always called it c+
most c++ programmers think theyre c++ programmers but they are really C programmers
or - are just bad
they arent bad, c++ is just so huge they have no idea what features theyre not using
if youre not writing obfuscated operator overloads in templates are you even trying?!
youre not even using multiple inheritance?
Good god, multiple inheritance, burn it in fire
c++ has cleaned up a lot but its not a good language for getting work done, and its not great for writing very low level code, its this middle ground for optimized algorithms that are a hassle to write in C
and you can really write unreadable indecipherable code in c++
I spend a lot of time working with macOS Cocoa UI's. In C#. A framework designed around using multiple inheritance in objective-C. C# doesnt have multiple inheritance
i was disappointed c# doesnt have multiple inheritance until i realized i have never needed it
objective-c was good until apple decided to copy windows and use garbage collection
copy windows? windows invented garbage collection? lol
I don't know who did or where it came from, I just know that it eats memory like a hog and doesn't let go
thats not true
That literally isnt what garbage collection is
Objective-C also isnt garbage collected
as i explained before, garbage collected memory blocks actually use less memory
Intentionally using unmanaged is an option yes
so are you saying NSGarbageCollector is not a keyword in objective-C?
but garbage collection improves performance, but as a programmer you have less control over when the delays hit
and it uses less memory in a GC like .net because it compacts the memory, removing fragmented unusable small spaces
NSGarbageCollector is not a keyword. Its a type, for manually adding a collector, much like you can write a garbage collector in your C++ code, Objective-C itself is not collected
apple pushed xcode to use it long ago, that's why I stopped bothering with objective-c
allan is a CS luddite, wont use anything from this century
if you tried to free memory, the compiler would give you errors so I dropped it like a hot potato
disregards the last 40 years of development and progress as overhead
sounds like a pebkac issue
also c++ full of garbage collection now
where it can, theres a lot .net cannot compact and that is causing me hell at the moment
but not really the efficient kind of garbage collection in c++, just the kind that protects forgetful programmers
you mean the past 20 years of development, yeah that has been going backwards and making code less efficient
yea large objects are a no go, but they arent causing fragmentation generally
Not just that
you are 40 years out of date, not 20
theres a tonne it cant free on the SOH too
Codebase does a lot of managed/unmanaged interop, generally requiring pinned objects
which cannot be compacted
pinned types?
you didnt want to just allocate them natively?
i suppose its ...the same thing huh
.net 6 has introduced the POH to help alleviate it
what is POH?
pinned object heap
so theres now a small object heap, large object heap and pinned object heap
items that would go on the small object heap but are marked pinned, now get stuck in the large object heap instead - POH isnt truly its own heap
is there an advantage of the pinned heap vs just marshalling some heap memory from the OS?
Unsure in all honesty, but in brief tests it at least solves some of the issues we were having
as unfortunately, as soon as the compactor encounters an item it cannot compact, it stops compacting the entire generation
so just 1 pinned object can basically just totally fuck compaction
i feel like i can get around most pinning these days
whether span is using it or not, im unclear, but damn i can get some great performance with span
codebase is mostly net 4.7.2, with 1 assembly in 4.8, and a few making it over the line into standard 2.0 as part of the road towards moving to net 6
ive been working with ffmpeg a lot lately and im getting speeds the same as the C routines available in the library now
with which language, python?
well C# is close to C++ in optimization, python on the other hand is like going to disney world on a horse instead of an airplane
I have to use span to get C speeds
The naive for loops don't cut it
while/do while loops are better than for loops
often compile down to same thing now if you're using a compiler from the last decade

the reason for loops are slower is because of the conditional statements it has to run through
i always ++i because its faster than i++ 
yes you are right ++i is better
but i want the conditional statement
in some cases, the goto keyword is better than an if statement or function call
for performance? usually.
but you have the shame of using a goto statement
this is ...like inlining everything
just let the compiler do its job
compiler is not always right
im not worried about individual clocks
no. but its right more often than my primate brain
I'd rather waste a clock than write a goto ever
Sounds like you love unreadable bug prone code
as this example https://pastebin.com/fM8EATg7 shows that compilers aren't perfect
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
i dont think goto is that buggy, its actually pretty easy to debug them
they got a bad rap because it made code difficult to prove
i guess they have a stink of amateur to them
the bad rap is programmers who don't want to learn more about the language they use
a lot of them were told never to use goto
nah, more programmers that know just because it was in the language once doesnt mean it should be, but equally you can't delete it
java did, didnt they?
MIT certainly never told people never to use goto
not but brian and dennis did
if break were smarter we wouldnt need goto
the problem with using a function call over goto is that a function call will push rbp onto the stack even if it's not needed
goto does not push rbp on the stack, so you have to be aware when you use it
these are generally not performance concerns tho, allan
you can break a lot of stuff using goto, but again if you can think about what the code will do on the assembly level, you can use it for performance
theyre very easy to track down tho
hi, can you tell me if there is a public logistics api to check base resource counts?
there is not
well here is a code example of using goto to jump to an error output, so rather than have a separate function for it you can simply just jump to it within main() https://pastebin.com/6jLY5APs
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
this is the functionality of C that other languages just don't have the ability to do as fast as C can do without intensive overhead of runtime libraries, basic string and character manipulation
yea but i can write it in one line
so if you ever want to write something more complicated than replacing commas or counting numbers, good luck dumping all of your time into C so you can get a 5% performance increase
also, zero terminated strings are ridiculous in the 21st century
lol
seriously, you cant loop unroll it, and youre gonna pay a time penalty just to get the string length, etc
I'm pretty sure everything still uses null termination in C#
just because youre using C doesnt mean you have to do things in an old and terrible way
it for sure does not.
even pascal (from before C) wasnt using null terminated strings
well you can disagree, that's fine, but I'm saying that it's still a thing
they simply include an integer with the string length
its still a thing ... yes. in C. in old C. its an anti pattern
there are alternative string libraries for C that wont use zero termination
if you care so much about every last ounce of performance ...
You live in a time of abundant processing power and memory, but developer time is still the same
It's time for modern tools to solve modern problems unless you legitimately have memory constraints
all the modern tools do is automate the things that lower level requires you to do yourself
Yes and saves the most expensive part- development time
so like null termination, yeah you don't have to do it, but the compiler is certainly doing it
if there was no null termination at all, your program would cause a buffer overrun on the first syscall
The library does it the compiler has no knowledge of strings
I have explained strings before, I'm not doing it again
Dont post me some unrelated sample
you're no true coder if you've never messed up the iostream library
I suppose the compiler turns string literals into asciiz but you dont have to use those and you dont have to terminate an array of characters with a zero, which is a valid character you cant even use in asciiz
it doesn't have to be in ascii, null is just 0, which is the same 0 in unicode, utf-8, etc
Such a short sighted string convention
Allan, imagine the first 4 bytes of your string were an integer specifying length and your libraries used that
the reason it is designated as '\0' in C is that when you use single quotes, you are referencing an ascii character
and on the CPU level, by the way, ASCII is still the standard for text
What. No.
unicode is not supported in real mode
There are some old interrupts that do, but c doesnt use those
I like how once again Allan has derailed into irrelevance. String encoding and termination are different things
And null termination isn't used a lot outside of c anymore
As derp said, most are length prefixed
hi there
well some will just not see it I guess
If length prefixing made no sense and null termination was just better in all scenarios, then they'd be null terminated everywhere, and oh look they aren't
C regularly does it the wrong way, regularly the worst way
Doesn't mean I hate C, it has a place
C has many bad conventions
But it is not the best tool for every single scenario ever
Two of the four text-string processing instructions specify string length explicitly. They use two general-purpose registers (EDX, EAX) to specify the number of valid data elements (either word or byte) in the source operands. The other two instructions specify valid string elements using null termination. A data element is considered valid only if it has a lower index than the least significant null data element. from page 308 of the Intel x64 developers manual
apparently even Intel instruction set uses null termination in machine code
Oh look. Only half use null terminators and the other half use prefixed
In your own quote you proved yourself wrong
2 prefix. 2 null suffix
Im out of date on c++, does everyone use the stl string library?
I know the standard library isnt using zero termination
Prefixing generally tends to result in it being trivial to perform a bounds check before even starting to parse the string or copy it to the buffer. Both improving performance in the error case and reducing chances of overrun. Additionally makes it trivial to perform a copy operation of known memory length rather than running until a particular character is reached - performance difference there varying on chip architecture and exact implementation remembering even the different intel generations aren't cycle accurate to each other
also the ability to use the 0 character
and unrolling loops because you have a known length ahead of time
lol
all of this you can do with C!
Garbage collected object oriented C is very possible
object oriented C? 
imagine working on a C project so big you need to OO it
it's really bad when programmers think that just because their high level language doesn't do this or that, that their code works the way they think it works
It's never as nice as a language where classes are a genuine language feature. But you can always shoehorn any paradigm into any language. There's even libraries for it in many cases. gObject for c for example
yea strings are so basic they really should be a basic type, and implemented well
everything eventually goes down to low level system calls, and those system calls are either done in assembly, C or C++ on all the modern operating systems
god i just cant imagine doing things in C/c++ anymore, it was so much work to do the most basic crap
its all machine code in the end, allan. and even that is basically byte code reinterpreted by the CPU
this idea that youre working at a native CPU level is false
there will never be system calls written in C# for example
And once again
but there are
but there aren't
you dont even know C#
Do I have to keep pointing out that there are tools for different jobs
ntdll is not made in C#
c# can still invoke C calls
all the system calls are in there
in fact it can invoke different types of function calls
function calls are not system calls
well they are when its a system library
you know theres an entire layer between machine code and actual instructions that are run, right?
a system call, for example 0x2c means ExitProcess() on Windows 10 on all the updates (but you can't count on it because Microsoft keeps changing the system call codes)
are you talking about interrupts?
Most of the .net standard library is pure C#. But file I/O etc is always gonna have a system call
Win32.dll for example on windows
i have to use interop system calls all the time in c# directly
you have no choice but to call either NtTerminateProcess() in ntdll or ExitProcess() in kernel32 to exit properly, instead of using code 0x2c cause one update to the next, MS could change the system call tables
your knowledge of C# and .net is very spotty
On that one he is right derp
.net is just wrappers for the underlying win32 API
Process.exit and application.exit both result in an eventual call to win32
programming in .net does not add anything to the OS
ok but im talking about interop
everything literally comes down to the win32 API, that's the bottom before it is translated into syscalls which are stored in tables
do you want to be a professional C programmer, allan?
Arithmetic, doesn't touch it. File IO or networking etc obviously does
yes basically everything, for example, printf is not a system call, it is actually a call to NtOpenProcess
the standard output is just a file IO on very low level in windows, and that has been there since windows NT when windows became posix compliant
Windows hasn't been POSIX compliant in a very very very long time.
you have to pass -11 in decimal to specify "stdout" for example
but in c# you can just define an external function call (using a C style method entrance) and call the system libraries directly
[DllImport()]
theres all the platform invoke stuff
what are you considering as system libraries?
which DLL's are you referencing to do this?
you can do it with any DLL
well ntdll.dll is the one I know of with most of the low level syscalls, the others like kernel32.dll are higher level wrappers for the syscalls
of course your portable program becomes windows dependent then
This is why there's usually Type.cs, Type.Windows.cs and Type.Unix.cs in the .net source code
All as partials. Occasionally split further as Linux and macOS specifically if required
Not everything in .net invokes win32 these days ;)
None of the string handling code touches kernel anymore. It's all pure c#
well it's wrappers to win32
It's not
its wrappers to any external dll
There is stuff that is
the wrappers handle the message translation and everything for you
Stuff that isnt
it's more complicated than you think
but also youre not aware of the capabilities of c#
So you literally thing absolutely every single line of c# is a wrapper to win32
You know how absurd that is. In a runtime that isn't even win32 specific
to make a window, you have to paint the screen, capture messages for the window, issue callbacks, translate messages into instructions on when to repaint the window on the screen, etc ... the higher level libraries do that automatically for you, but I assure you that it exists, otherwise it wouldn't work
That I've repeatedly pointed out, does involve where appropriate
Point out where I said using a GUI didn't invoke kernel
you are somehow thinking that everything is magic, it is not
if we were still stuck using c# computing would suck now, itd be 20 years behind where it is now
Point out where I thought something is magic
still implementing linked lists lol
I even specifically mentioned files as an example of something that invokes win32
Yet strings as something that doesnt
we will never break through this wall of "C is the best, even tho I don't know other things"
Clearly painting a window will. Don't dispute that
it has nothing to do with C, we're talking about windows native API
well at least you can admit it
lol
whats the largest program youve written, allan?
lol
If I'm computing Fourier transforms on captured data from an oscilloscope, am I invoking the kernel
Maybe I might in order to spin up and manage a new thread if appropriate for the workload (unlikely in a 1 dimensional fft) and maybe for a mutex. Otherwise. No. Not during processing.
And no, the corresponding code in . net or even in python, won't invoke the kernel at all for that
whats the mutex for?
Syncing the thread -if I even make one, and if required. So likely no mutex
hmm well you can sync a thread without a mutex.
kind of a specific type of thread safety
If I then log that data to a file post computation. Then I'll clearly be invoking the kernel
if everyone thinks like you guys, in 20 years there will be no computer updates because there won't be anyone who knows how to program for the CPU
i suspect i have years more C experience than you
perhaps people who think like us are because they know more
I doubt it
C is so easy its not like there will ever be a lack of people who know it
You do realise my degree is embedded systems programming. I have programmed in C, for both x86 and assorted mcu's. I have done assembly in msp430, avr, mips and x86. I work in c# as a profession sure. Doesn't mean I don't know C. I have written CPU emulators. I have written an assembler
yea and ive written x86 assembly for 5 years
thinking that "C and Asm are outdated" is thinking incorrectly and leading to a major disaster in the future when we will not have anyone left to keep the API up to date
I never said out dated
oh ill say it. its outdated
I said not the right tool for the job in all scenarios
Because it isn't the right tool for the job
shit, you could do all the same work in rust
Rust is not quite at a mature 1.0 yet.
ive never been one to wait for 1.0
That's all I have against it
i cannot imagine being a programmer these days without knowing modern languages, like java or c# or javascript...
i would never hire that person
theyd spend a year doing the work a fresh college grad could do in weeks
But frankly I wouldn't employ a person that thinks the only way to code is in C, if it means they waste a week writing something in C that could have been written in 5 minutes in python and the python performs the job satisfactorily
and yet, i think every programmer should know C, youd be so hamstrung without it
C is basically pseudo code now
Equally. I ain't gonna go and have some ridiculous number crunching done in python.
remember the old days when youd find an algorithm example in delphi or fortran? lol
but you could. why not. throw more cheap computing power at it
Eh, libs like scipy I guess, albeit, their main crunching logic is in C
sure, if its done for you might as well use it
But would again depend on project requirements
but ive got no problem if my c# program runs half as fast, i can just run it on two cores
its not like im waiting for a slice of time to run my program on a univac
C# generally gets you 90% of the way there these days anyway, and probably with half the effort
yes it is faster to develop (not faster to run), but thinking that it will replace C for good is wrong thinking
Where did I say it will replace c for good
We had someone at work think C was the only way to do things. So we had a little challenge for fun.
Project Euler, first 10 problems
it reminds me of the people who think manual transmissions are the be all end all. omg the mileage is better. youre not a real man if you dont use a clutch, etc.
until you break your foot or you want to drive and eat at the same time
or lend someone else your car 
My c# solution compiled and executed faster on a Jetson nano with .net core 3 on Ubuntu 18, faster than his first 5 problems ran in C on an i7-7700 also under Ubuntu 18
because he couldnt implement quicksort without 2 weeks lead time?
Pretty much
i assume it was his poor choice of algorithms
ubuntu has other problems, C is not one of them
ubuntu is one of the worst linux distros
On a 4 core 1.5ghz cortex a57
im working on a video editor, and it compiles my c# code and runs it on the gpu, the first time i ran it on arm on my jetson nano my brain almost exploded
i wrote it on amd64 on windows and then it runs on a jetson nano lol
with cuda.
i still can barely believe it works
they still have a bug in the OS where if you read from an SSD, it will try to read from your DVD burner (if you have one) and throw an error
have you tried installing apps from the GUI instead of terminal window? lol
See it was great when mono got us net framework on Mac and Linux. But mono was very rough round edges. Netcore, droolworthy
it is so bad, if the GUI is so broken they need to just scrap gnome and make something else the default window manager
I just use plain linux, like slackware, gentoo or rasbpian
Unfortunately, I rely on mono currently at work
ooof im so sorry
I have no preference, but I don't use GUI
a lot of my stuff i compile now for musl/alpine with .net its such a joy
well if you think ubuntu is among the worst you must think there is a best
yes I think macOS is the best linux distro, and before you laugh, I know it's not linux, but to be honest, how many issues does macOS have compared to Ubuntu?
what was that old linux distro the super linux dorks used to use. gentoo?
i feel like they all migrated to arch
macos full of issues as far as i know
Yeah, WPF+netframework 4.8 on windows, GTK+Mono/.net 4.7.2 BCL on Linux. Xamarin.mac on a Mac, under the hood being a weird hybrid of mono 6 with a modified net 4.8 bcl with standard 2.1 compatability that regular net 4.8 doesn't have
at least on macOS, the GUI actually works
and yea ... its not a linux distro, you cant say that
Working with Mac professionally
It's super buggy
Usb stack in particular is horrific
as much as i hate apple i cant deny their gui is pretty good
Eh, until you mix retina and non retina displays in a single multi monitor setup
I just stick to windows, it makes no sense to switch to X
At which point it can't decide on whether it wants to anti alias fonts properly and bugs out badly
my only experience with retina issues is in web development front-end. javascript ... and high resolution is funky
no X is terrible its definitely not the strong suit of linux, im just curious if you dont like ubuntu which alternative do you think is better
It has different font kerning and anti aliasing settings for retina v non retina
i guess you think theyre all better?
I have several computers, the mac one never gets booted even though it is nice to use macOS
And if you have multi monitor setups on a Mac. That setting will be wrong for at least 1 display
im stuck on windows as long as visual studio is exclusive to windows
Resulting in the font rendering as if it's smudged on either display
i cannot imagine a less capable dev environment
I'm thinking Fedora is going to be the one I pick after windows 10 goes to crap in a few years
hmm fedora ... you dont hear much about it these days
Fedora is in my pile of least favourite distros
i personally hate RHEL/fedora
Above opensuse
debian was always too concerned with stability for me, too many problems
Reminds me, need to check if the mono package in Fedora is still broken
i do very much enjoy alpine
It's a fedora maintained package, the rpm direct from xamarin is correct
Had to work around it to get works software to install on fedora
it seems almost irrelevant now, i dont run anything outside of a container now
the hosts are so ... bare metal im barely concerned with the distro if it can run podman or docker
Opensuse, they've switched package manager to zypper. Zypper does some funny funny things
I tried to install Fedora a couple years ago and the installer didn't work
The installer is still broken on a 1920*1080p screen
allan have you used the linux subsystem on windows?
cygwin?
no...
wsl 2 is basically a virtual machine with tighter integrations
Windows subsystem for Linux. Added in win10
its an easy way to get a linux command line on your linux machine. you can run it as a vm or more like cygwin with the native compilation (wsl 1)
And with 11. Wsl2g
but the new version of wsl2 with windows update 21h2 has graphics card support
windows 11 or 10
I tried cygwin long ago on a 200mhz pentium 1 and it ran horribly slow compared to windows 95
cygwin was ... fine for performance but buggy because the library support
wsl is a feature for windows you can enable, and you can install any linux distro
WSL is more Linux kernel in hyperv. With mapped storage bidirectionally. With WSLg, X forwarding too
its a great way to get yourself a fully working linux command line on your windows machine
WSL1 is less like a virtual machine
its more like cygwin...
Can do weird and whacky things like launching windows applications from the Linux bash shell
And vice versa
I already use the command line through ssh, but mostly on FreeBSD
Powershell window on windows, using Linux installed wget, in a windows directory
its just nice to have linux tools on a windows machine that are reliable and predictable and come from a known distribution
yea ssh is fine but you have to run another computer. its nice to have linux right on your windows machine
freebsd huh?
Fun macOS bug for you guys. Present since apple first introduced USB controllers on PowerPC products
I am not a fan of the new FreeBSD releases, the project went down the hole since 2010 or so
but the older releases were really good
If it encounters either 2 usb devices enumerating at once. Or 2 usb devices disconnecting at once. Or 1 connecting and 1 disconnecting
yea bsd has been sadly in decline with the popularity of linux
It can get the usb driver in a deadlock
and now that linux has zfs i have no reason to stick with freebsd sadly
containerd > jails, linux hardware support is just better
All usb devices on the system cease functioning, on every controller in multi controller systems
always loved the monolithic kernel of bsd tho
If any usb device (including the one that was unplugged) was an audio device, you also lose the audio stack
As every Mac except the newer M1 based ones uses usb based Bluetooth, you also lose Bluetooth
its almost inexcusable apple have bugs for so long. its not like theyre supporting a billion combinations of hardware
is boot camp dead for m1 hardware?
Absolutely
oof breaks my heart
Remember M1 is arm not x64
i know but windows is on arm
.net 6 already compiles for m1 which is cool
when i recently updated the tiler people use for foxhole maps, i added an m1 binary
Bootloader isn't just not locked. It's intentionally unlocked and third party OS booting is explicitly allowed
Linux porting is going extremely well
if i were primarily a linux user id heavily consider buying new apple laptop
i hear that m1 is fast AF
Microsoft have stated they have no interest in porting windows at this time
i am not surprised
And nobody has so far looked at taking on the challenge in doing it as a community port
Ie, pi style
no .. itll have to be virtual machines or something
is that what KDE looks like now
Yes
Already done
with video accel?
it is sad that gnome killed itself
Parallels supports windows 10 for arm
used to be the best
Dunno what state of acceleration is
if you cant passthrough GPU then it wont be much use for gaming
or anything really
its not like you cant edit a spreadsheet in osx
thatd be a deal breaker for me, although if youre a gamer using an apple laptop maybe youre not a serious gamer
No but on the M1 max, there's a huge amount of GPU performance on tap for something that doesn't have a discrete gpu
the thing is mac has a better chance of getting game developers than linux, because of the GPL problem
GPL isnt really an issue for game programmers
GPLv3 will forever be the thorn in linux
it should have been a requirement that all libraries are ineligible for GPLv3, and require libraries to only be allowed under LGPL
i cant think of any example where gpl is an issue for game developers
or at least BSD licensing
well ... it wouldnt be linux with bsd licensing would it
Should also note. The usb issue above is still present on m1
LGPL allows linking to libraries, that's where the advantage is
The only difference. The cause of the bug is a race condition. It expects the usb event queue to be processed in a particular time span during the re-enumeration
licensing is complicated
you will never get game development with GPLv3
It's harder to exceed the timespan on M1, but possible
because game devs need to get paid and don't want to throw source code out
if you link to a library that is under GPL3, it's no longer closed source
depends on the libraries you link to
libraries used for games are not gpl3
Gplv3 isn't allowed in linux
vulkan is apache license, opengl is similar to BSD
there are some gpl sound libraries you can choose not to use
I wish that were true, lol
really i see no issue developing software for linux, you wouldnt have to share source
theres countless examples of developers not sharing their code
More so. Never has anyone at the Linux foundation raised it as an issue, despite the increasing popularity of gaming on linux
one could argue a lot of linux gaming is operating with ...windows binaries lol
There's also the GCC runtime exception
but yea theres a ton of stuff on steam compiled for linux, no source code
as much as i deeply hate gpl its never really caused me any development problems
agpl is the real monster.
You have permission to propagate a work of Target Code formed by combining the Runtime Library with Independent Modules, even if such propagation would otherwise violate the terms of GPLv3, provided that all Target Code was generated by Eligible Compilation Processes. You may then convey such a combination under terms of your choice, consistent with the licensing of the Independent Modules.
its so counter to the intent of gpl its disgusting
lol what do those words mean? are they defined?
target code? "combining"?
"Independent" rofl
Much of linking against the Linux API is already either allowable by the libraries existing license, gplv2 or the GCC exception
That tl;Dr and FAQs down to you can link against quite a few gnu libs in proprietary software in many cases
sometimes i wonder how significant containers are affecting gpl
like, if i externally link ffmpeg, but then i use the gpl3 version and i make a docker container that installs that one ...
isnt it kind of like the end user doing it?
do i have to provide a dockerfile instead of the image?
how is everyone else posting docker images without violating gpl
End user is also accountable for licence violations
dockerhub is in theory one big gpl violation
it's a legal can of worms and convoluted so that you never know the grey area until you put effort into a project and then have to hand over all your work for free to some guy just because you linked to something trivial
aha allan, theres a solution
if youre forced to release source code, release it as agpl 
then nobody can use it
its stability is probably the biggest reason
the kernel is pretty damn rock solid
i find myself wondering if this is because largely of the vision of a single programmer, and how large can a project grow centered around the ideology of a single person
well if Linus switches the codebase to C# I'm not sure that it will still be rock solid and efficient
might as well rewrite socket.h in php and see how that goes, it would be a similar move

Note neither of us ever suggested doing that
But. Rust is already working it's way into the kernel to replace c/C++
Yes because a safe language would be bad for stability?
Linux is not great because of the language it's written in
Also note that the Linux kernel is also not bug free
I'm thinking more along the lines that it would become slow like windows and then people would fork the project to another thing for server dev
It's only very recently a major privilege escalation attack was found and thankfully rapidly fixed
Windows is... not slow, unless you mean specifically explorer.exe
"prevents all segfaults" sounds good until all the memory leaked from other places get read by malicious code that keeps running indefinitely due to the language keeping it from crashing
crashing is sometimes a good thing, it tells you when you made a mistake

I read about rust, wasn't excited about preventing crashes due to bad code
you can already do that in C actually by managing signals
do you like your car without an airbag and safety belts too?
hmm and thats a 10/10 analogy
like you prefer older cars before they had crumple zones and airbags and only had a lap belt and no anti lock breaks
crashing due to buffer overflow is actually more like an airbag than preventing the crash and allowing all the sensitive data to be leaked from another process
because they used less fuel (not really) or drove faster
it's actually more secure to crash than to not crash, because the crash prevents malicious code from reading memory of another process
crashing potentially your whole OS just to know you have a small bug somewhere is like thinking seat belts kill more people than they save
well that is a linux problem
thanks, i dont need my entire computer to die because somebody started counting at 1
linux purposely crashes when something goes wrong
anyhow you can turn that off in windows
you can surely compile a rust program without that
would you rather have an unbootable system or a system that crashes when something goes badly wrong?
wait why would it become unbootable?
if your buffer overflow causes garbage to leak into the kernel and save to system files, you will be left with an unbootable system
why would it save to system files
thats not like something that would happen accidentally
I absolutely prefer the computer to crash rather than have the system files corrupted and prevent booting
because program instructions and virtually everything is in memory
is this some scenario where a virus is doing it?
why would the kernel write over the boot loader
it doesn't have to be a virus, if random junk is overwritten to the memory location of the kernel files, it can very easily trigger a write instruction
to write over the kernel thats compiled and compressed as an image?
it could even be worse if it happens to have elevated privileges and write to other places, like bios
that can be done
its not going to do that from a random piece of memory overwriting, that would have to be targetted
thats not going to happen from randomness in any likely reality we are in
segfault is done on purpose, it's designed that way to protect the system, that is literally a security feature
like I said you can disable it if you really want to, by capturing the signal and preventing the program from exiting
usually programmers do that so they can return an error message
I think it's bad to abuse the try {} method of C# to prevent crashes, absolutely
exceptions are not segfaults
i should point out c++ also has exceptions
its not ... abuse its a conditional statement (logically)
the intention is for doing things like sending an error msg to the user, recording it in a logfile or something, but if you let the buffer overrun or whatever to continue, it can lead to some serious security holes
if you did it in openbsd, theo would give you a long lecture about it
you cant catch a segfault.
ok ...maybe im understanding you. im trying. you would prefer the OS handle reading/writing out of bounds than the program itself?
oh i guess people can catch that signal
in C, it's sigaction(SIGSEGV, &<function for handling seg fault>, NULL);
im not aware of anybody doing this intentionally, allan
for a particular use case maybe, like a host program that runs another process maybe
so im still confused. you would like every program on a computer to have access to the memory anywhere else on the computer?
yes because if you don't prevent the program from overrunning the buffer, it is a security issue
but these languages do prevent you from overrunning the buffer
of course they do and that's why they are bad, but on the plus side, they are good for making development much smoother
why is it bad? i thought you agreed it was good to prevent that
ideally you want to use that to your advantage to debug the program, but you don't want to have your users deal with the security implications of it
but you wont catch every segfault by just debugging
its the same reason you wont catch integer overflows
youre not testing every single scenario that can happen...
well integer overflow isn't a thing because integers are a set bit length
unless you mean arrays
no
arrays can overflow, you need to terminate them
integers have a set bit length, so like a regular int is generally 4 bytes, whereas a string can be any number of bytes from 1 byte up to whatever your memory can hold
answer my 'riddle'
an array is almost like a string
i am not talking about arrays
on the CPU level, there is no distinction between data types except for floats
but then again, floats are simply just considered floats in a specific register
it depends a lot on the architecture
some will keep it to 0xff and set the sign flag and carry flag
then do you know what integer overflows are?
yes there is a flag for overrun
do you test for integer overflows every time you do an add?
you can
but do you
libraries will handle it for you if you use libraries, otherwise you can check eflags
usually you test input to ensure you never go above the max value
you would have to prove your code
testing would not be enough, youd have to prove it by induction
otherwise one could creep in
or you can just ... test it every time
the thing is, one byte isn't going to cause a problem, because the CPU will only access one memory location for a one byte value
same thing for buffer overruns