[video output=day328 member=cmuratori stream_platform=twitch stream_username=handmade_hero project=code title="Integer and String Support in Printf" vod_platform=youtube id=kxHN6ICgjgQ annotator=Miblo] [0:26][Recap and set the stage for the day] [1:25][handmade_shared.h: Consider what we must implement in FormatStringList()] [4:51][handmade_shared.h: Begin to enable FormatStringList() to handle decimal, hexadecimal and octal integers \[see Resources: C++ Reference\]] [11:14][handmade_shared.h: Introduce U64ToASCII()] [13:38][Blackboard: printf] [16:47][handmade_shared.h: Implement U64ToASCII()] [18:57][handmade_shared.h: Enable FormatStringList() to process the data returned by U64ToASCII()] [20:28][Run the game and see our integer printouts] [21:21][handmade_shared.h: Enable FormatStringList() to handle write back for the %n format and obey flags[ref site="C++ Reference" page="printf" url="http://www.cplusplus.com/reference/cstdio/printf/"]] [27:11][handmade_shared.h: Enable FormatStringList() to handle AnnotateIfNotZero and introduce OutChars()] [30:17][handmade_shared.h: Enable FormatStringList() to handle Prefixes] [35:14][Run the game and checkout the printout] [35:47][handmade_shared.h: Enable FormatStringList() to handle UseWidth and UsePrecision] [38:34][A few words on this approach of boiling down complexity to simplicity] [39:06][handmade_shared.h: Continue enabling FormatStringList() to handle UseWidth and UsePrecision] [46:30][handmade_shared.h: Enable FormatStringList() to handle LeftJustify and PadWithZeros] [49:04][Run the game and see the beautiful printout] [50:38][Homework: Enable FormatStringList() to handle floating point values[ref site="Marc Andrysco, Ranjit Jhala, Sorin Lerner" page="Printing Floating-Point Numbers: A Faster, Always Correct Method" url="https://cseweb.ucsd.edu/~lerner/papers/fp-printing-popl16.pdf"]] [53:32][handmade_shared.h: Make FormatStringList() only create temporary buffers where necessary, and enable it to obey precision for the %s format] [58:42][Run the game, see that the strings print backwards and hit the assertion in FormatStringList()] [1:00:06][handmade_shared.h: Make FormatStringList() correctly increment the At, run the game and note that the strings are backwards] [1:00:37][handmade_shared.h: Give FormatStringList() the ability to choose whether or not to reverse the characters] [1:02:02][Run the game and admire the beautiful printout] [1:02:17][handmade_debug.cpp: Play with the formatting in DrawTopClocksList(), running the game and seeing it all working fine] [1:04:58][Q&A][:speech] [1:05:39][@neres909][I posted my question twice on pre-stream but both times it wasn't addressed. I experienced a bit of lag back then so I checked on archive what's up and it wasn't there. Am I doing something wrong?] [1:06:31][@hayai][A few people in the twitch chat are asking about what level of math do you think is required to be an effective programmer] [1:08:26][@internal_static_void][Casey, I understand that you are replacing all the string header functions (strlen, etc.). Are you not worried about optimization for these new functions you plan to write?] [1:09:14][@tiferet418][I'm just trying to learn how to code. I'm following Stroustrup's book and he insists on teaching using math. All the good beginner books tend to assume math knowledge] [1:12:27][@neres909][And again. Just let me know if you see it[ref site="Handmade Network" page="Handmade Network IRC" url="https://hmn.handmade.network/blogs/p/1138/1"]] [1:14:26][@neres909][Hey. In one year I'm graduating and it will be time to find a job. All I always wanted was to work in the game industry but I have no work experience or projects that I am proud of to show as my portfolio. I guess you were leading programmer in your projects and you were responsible for making decision who to hire] [1:15:52][@neres909][How you see people like me in this decision? Should I take whichever offer as a programmer I could find which might not even be connected with games, or maybe try to make the best game I can do in one year, or save some money and do an internship without salary (I didn't see any studios with a paid one in my region)? What's your opinion?[ref site="Molly Rocket" page="HandmadeCon 2015 - Mike Acton" url=https://mollyrocket.com/news_0035.html][ref site=Twitter page="Moving towards an interactive path tracer. I find I'm using @handmade_hero 2D rendering code time and time again" url=https://twitter.com/handyj443/status/765320487727665152]] [1:27:46][@neres909][Thank you for the in-depth explanation! I have one more Q: Since you're going on a break, can you trash out OOP just a bit so we don't get confused in the time you're not there, and stick to beloved compression oriented programming] [1:29:12][Wrap it up][:speech] [/video]