|
you know how it goes. you're 6 subroutines deep and suddenly you need a buffer. what do you do? for me it depends on the kind of buffer. If I need an array of objects, I use 16. double digits, power of 2. seems reasonable enough. if it's for a string, I use MAX_PATH. don't worry, I add a definition for non-Windows platforms. (the string does not have to be a file path.) if I need a byte array, I grab 64kB. some people might use 1MB but that seems wasteful imo
|
# ? Jun 27, 2017 01:34 |
|
|
# ? Jun 3, 2024 21:52 |
|
CLINE_SIZE or PAGE_SIZE like a pro
|
# ? Jun 27, 2017 01:43 |
|
Gazpacho posted:you know how it goes. you're 6 subroutines deep and suddenly you need a buffer. what do you do? code:
|
# ? Jun 27, 2017 01:45 |
|
|
# ? Jun 27, 2017 01:49 |
|
gah, every time I need to take a piss she shows up
|
# ? Jun 27, 2017 01:50 |
|
14kb
|
# ? Jun 27, 2017 01:50 |
|
i'm not a caveman so i avoid using c arrays directly std::vector (or std::deque ) if i'm in the sewer writing code for the heathen platforms, or NSArray or NSMutableArray or NSData or whatever if I'm in a luxury condo writing code for the Good Operation Systems
|
# ? Jun 27, 2017 03:03 |
|
bathroom zamboni? lol
|
# ? Jun 27, 2017 03:19 |
|
akadajet posted:gah, every time I need to take a piss she shows up she knows
|
# ? Jun 27, 2017 05:24 |
|
you should always choose either a power of two, or a power of two -1. that way anyone who looks will assume that theres some technical reason why you chose that size and you will look good
|
# ? Jun 27, 2017 11:11 |
|
Sweevo posted:you should always choose either a power of two, or a power of two -1. that way anyone who looks will assume that theres some technical reason why you chose that size and you will look good no you have to pick arbitrary numbers that make it look like you did a calculation
|
# ? Jun 27, 2017 12:13 |
|
lol if you don't use a 69-byte buffer
|
# ? Jun 27, 2017 15:02 |
|
219, 420, 1137, and 80085 are also acceptable
|
# ? Jun 27, 2017 15:20 |
|
1000 bytes
|
# ? Jun 27, 2017 15:28 |
|
what kind of buffer sizes do you get on a 36 bit computer
|
# ? Jun 27, 2017 15:29 |
|
Sweevo posted:1137 turn in your badge, you're fired
|
# ? Jun 27, 2017 15:29 |
|
i was honouring the entrants of the LIET minority language song contest thats my story and i'm sticking to it
|
# ? Jun 27, 2017 15:51 |
|
in swift or objective c i never really have to worry about this, but maybe an NSMutableArray/Dictionary
|
# ? Jun 27, 2017 16:00 |
|
i use my bespoke fixed page stack allocating buffer if it doesn't need to be returned to the caller. otherwise its malloc(PAGE_SIZE)
|
# ? Jun 27, 2017 16:18 |
|
i just put stuff at random memory addresses and trust in the providence of the good lord that everything will be fine worst case scenario there's a crash and the load gets redirected to other instances it also confuses the hell out of hackers so that's good for security too
|
# ? Jun 27, 2017 16:29 |
|
code:
|
# ? Jul 1, 2017 20:50 |
|
Sweevo posted:you should always choose either a power of two, or a power of two -1. that way anyone who looks will assume that theres some technical reason why you chose that size and you will look good power of two plus one to maximize wasted space
|
# ? Jul 1, 2017 21:07 |
|
the field for team abbreviation in ESPN Fantasy Baseball only supports 4 bytes and is homophobic 💑 sticks 👨❤️👨 gets changed to 👱
|
# ? Jul 1, 2017 23:51 |
|
I'm currently using a 29-byte buffer because the data I'm handling has a fixed 3-byte preamble and then goes into a register that's 32 bytes wide. Feels pretty good op
|
# ? Jul 2, 2017 00:15 |
|
suffix posted:
lol
|
# ? Jul 2, 2017 00:44 |
|
quote:When I worked at Planet Moon, we made an educational game for the Gameboy DS called BrainQuest. The DS only has 4MB of RAM, and toward the end of the project, we were running right up against that limit. When the final assets came in and were added to the package, we were just over the 4MB limit. One of the engineers grinned and walked over to his computer. He opened up main.cpp and commented out the following line:
|
# ? Jul 2, 2017 00:46 |
|
suffix posted:
murder this person
|
# ? Jul 3, 2017 16:11 |
|
256
|
# ? Jul 9, 2017 15:21 |
|
LRECL=80, op
|
# ? Jul 9, 2017 16:21 |
|
suffix posted:
5
|
# ? Jul 9, 2017 16:23 |
|
akadajet posted:gah, every time I need to take a piss she shows up if you weren't such a messy pisser she wouldn't need a zamboni to clean up after you
|
# ? Jul 9, 2017 17:07 |
|
also the answer is whatever the stackoverflow example code I find to solve my problem is using
|
# ? Jul 9, 2017 17:08 |
|
ADINSX posted:if you weren't such a messy pisser she wouldn't need a zamboni to clean up after you the proper term is maamboni
|
# ? Jul 9, 2017 19:54 |
|
code:
|
# ? Jul 9, 2017 20:51 |
|
i use a buffer size of one dickabyte being a programmer, of course, one dickabyte is
|
# ? Jul 10, 2017 15:50 |
|
Poopernickel posted:i use a buffer size of one dickabyte whatever u fuckin typdef it to be
|
# ? Jul 10, 2017 17:51 |
|
you claim it's eight but it's actually 4.5 tops
|
# ? Jul 10, 2017 18:32 |
|
Sweevo posted:you claim it's eight but it's actually 4.5 tops
|
# ? Jul 10, 2017 20:48 |
|
use whatever size you want just be polite about it code:
|
# ? Jul 10, 2017 21:09 |
|
|
# ? Jun 3, 2024 21:52 |
|
always be heaping
|
# ? Jul 10, 2017 23:08 |