Blog

  • Chastelib Readme and Manifesto

    Chastelib is a library I have been developing since mid 2025, though some of the functions have existed in some form for 20 years and have been hacked together as I needed them for projects. Over the past 6 months, I have refined them and have extensively documented the source code, and have even begun writing a manual on how to use them. This project will take years, as I have fun improving things and explaining why my own methods of outputting numbers now surpass the capabilities of the C and C++ standard libraries when it comes to printing integers in other bases.

    To my knowledge, nobody other than me uses these functions, but they are extremely easy to use by including header files or just copy pasting the functions you like into your own C and C++ projects.

    Core Function List

    • intstr: Convert an integer to astring in bases 2 to 36
    • strint: Convert a string in bases 2 to 36 to an integer
    • putstring: Print a zero-terminated string to standard output
    • putint: Print an integer using intstr and then putstr

    To understand the context of this library and how it came about, you have to know that I have been a C programmer for 25 years. Most of my projects are just toy programs for printing sequences of integers. Even more strange is that I enjoy bases other than ten, referred to as decimal by humans.

    Math is a game to me, and I do computer programming for fun. I also think that the C programming language is the best programming language to ever exist. However, there are some limitations that come with it.

    The printf family of functions can output formatted text containing arbitrary strings of text with format specifiers and arguments to print integers and floating point numbers.

    For integers, there is the %d for decimal, %u for unsigned decimal, %X for hexadecimal, and %o for octal. Although these are the most common number bases used, I prefer the option to print binary. The %b format specifier does exist as a GNU extension, but because I like my code to conform to the 1989 standard, I decided I should write my own set to manage the conversion of integers to and from strings that I can always rely on.

    Of the core functions, only putstring uses a C standard library function. It uses the low-level fwrite function to write a string after finding its length by searching for the terminating zero.

    Although simple, the putstring allows me flexibility when I am translating chastelib to use a new C library, or when I want to translate all the functions to another programming language.

    For example, when using other languages, I can’t rely on printf being available. Moreover, printf is a complicated function to write, and I have no idea how it actually works. When I tried translating my functions to Rust, having putstring as my trusted output function helped a lot. That being said, Rust is a painful language, and I stopped because it hurt my head too much, which is saying something, given how good I am at Assembly language on Intel platforms.

    The putstring function also helped when I was using ncurses because I could just change putstring to call addstr, which does the same thing in the context of terminal programs written with ncurses.

    The other functions don’t read or write to any devices and rely on putstring to show results. However, this means they execute very fast. Not only is C fast because it is a compiled language, but I have incrementally improved my algorithm over months to do the work quickly, and also made the code look good at the same time.

    Of all the functions used, strint is used the least because most of the time I am the only one providing input to my programs. If other people were using my programs, they would of course provide strings from the keyboard that would be parsed as integers. I have tested the function to ensure that it works correctly. In fact, my program chastehex was why the function was originally written. I could have had a generic hexadecimal converting function, but I made one that was flexible and supported any base from 2 to 36.

    Technical note: Base 36 is the highest base because digits 0 to 9 are used for digits less than ten. Letters A through Z are used as 10 to 35, whether they are uppercase or lowercase. The ten digits plus 26 letters of the English Alphabet provide a standard that programmers have used before I was even born. It is a good standard, and so I stuck with it.

    Future Extensions

    • floating point conversions
    • ncurses utilities

    The Github repository with the latest source is here:

    https://github.com/chastitywhiterose/chastelib

  • Determinism

    Do you believe in fate/destiny?

    I don’t believe in the religious concept of fate/destiny where the greek gods have decided what will happen in my life.

    However, things are still predetermined to happen as they do because I cannot control my body nor my desires.

    This is especially relevant today for example. I am sick and have not been able to breathe well enough to sleep well. I also had to call into work because I was too sick.

    I spent a long time recording podcasts explaining the illusion of free will back when I was Executive Producer of the Free Will, Science, and Religion podcast. This prompt about destiny reminded me of those days.

  • Pedophile

    If you could permanently ban a word from general usage, which one would it be? Why?

    I do not actually support banning words, but for the mental exercise and to make a point, I believe that people should stop using the word pedophile because they use it interchangeably with “child molester”.

    Stop conflating those who have harmed children with those who may have been born with an unfortunate attraction but still know better than to have sex with a child.

    • Not all pedophiles rape children.
    • Not all who rape children are pedophiles.

    Society has yet to have a serious discussion on this topic. When I see people say that we should “kill all pedophiles”, I am concerned about the innocent pedophiles who may have a sexual attraction to children but will never act on it because they know it is wrong to do so.

    Here is a simple fact. People do not have sex with everyone they are attracted to. First, they may be committed to celibacy; second, they may be monogamous and only have sex with their spouse, who they are no longer attracted to, but they have been married for 50 years, so they might as well. Third, we need to be wise in how we use our words so that we don’t mislead people into thinking we are talking about something we are not.

    But the question weighing on my mind most is, if someone is a pedophile, where do they go for help? To a therapist? To a pastor? I don’t really know what I would do if I were in their situation because anyone they go to for help will probably kill them or call the police and put them on a sex offender registry, even though they have never touched a child.

  • C chastelib core 2-25-2026

    There comes a time every so often when I find a typo in my source code. I recently found one in the C version of chastelib. I used the opportunity to expand on my existing comments to better explain the purpose of these functions which are used in my chastehex and chastecmp programs.

    I am also working on extension libraries to add to chastelib to support future command line utilities I might write, even if I don’t know what tools I will write. I have dreams of making my own small programming language but what I imagine is more complex that I am prepared for at my skill level and lack of free time.

    I just finished my Programming 2 class about C++ and I have to say that I still prefer C, even though there are some features of C++ such as function overloading that I find extremely cool.

    Anyway, read below this years edition of the 4 functions that make up the core of chastelib, my own standard library I am building.

    /*
     This file is a library of functions written by Chastity White Rose. The functions are for converting strings into integers and integers into strings.
     I did it partly for future programming plans and also because it helped me learn a lot in the process about how pointers work
     as well as which features the standard library provides, and which things I need to write my own functions for.
    
     As it turns out, the integer output routines for C are too limited for my tastes. This library corrects this problem.
     Using the global variables and functions in this file, integers can be output in bases/radixes 2 to 36
    */
    
    /*
     These two lines define a static array with a size big enough to store the digits of an integer, including padding it with extra zeroes.
     The integer conversion function always references a pointer to this global string, and this allows other standard library functions
     such as printf to display the integers to standard output or even possibly to files.
    */
    
    #define usl 32 /*usl stands for Unsigned String Length*/
    char int_string[usl+1]; /*global string which will be used to store string of integers. Size is usl+1 for terminating zero*/
    
     /*radix or base for integer output. 2=binary, 8=octal, 10=decimal, 16=hexadecimal*/
    int radix=2;
    /*default minimum digits for printing integers*/
    int int_width=1;
    
    /*
    This function is one that I wrote because the standard library can display integers as decimal, octal, or hexadecimal, but not any other bases(including binary, which is my favorite).
    My function corrects this, and in my opinion, such a function should have been part of the standard library, but I'm not complaining because now I have my own, which I can use forever!
    More importantly, it can be adapted for any programming language in the world if I learn the basics of that language.
    */
    
    char *intstr(unsigned int i)
    {
     int width=0;
     char *s=int_string+usl;
     *s=0;
     while(i!=0 || width<int_width)
     {
      s--;
      *s=i%radix;
      i/=radix;
      if(*s<10){*s+='0';}
      else{*s=*s+'A'-10;}
      width++;
     }
     return s;
    }
    
    /*
     This function prints a string using fwrite.
     This algorithm is the best C representation of how my Assembly programs also work.
     Its true purpose is to be used in the putint function for conveniently printing integers, 
     but it can print any valid string.
    */
    
    void putstring(const char *s)
    {
     int c=0;
     const char *p=s;
     while(*p++){c++;} 
     fwrite(s,1,c,stdout);
    }
    
    /*
     This function uses both intstr and putstring to print an integer in the currently selected radix and width.
    */
    
    void putint(unsigned int i)
    {
     putstring(intstr(i));
    }
    
    /*
     This function is my own replacement for the strtol function from the C standard library.
     I didn't technically need to make this function because the functions from stdlib.h can already convert strings from bases 2 to 36 into integers.
     However, my function is simpler because it only requires 2 arguments instead of three, and it also does not handle negative numbers.
    I have never needed negative integers, but if I ever do, I can use the standard functions or write my own in the future.
    */
    
    int strint(const char *s)
    {
     int i=0;
     char c;
     if( radix<2 || radix>36 ){printf("Error: radix %i is out of range!\n",radix);}
     while( *s == ' ' || *s == '\n' || *s == '\t' ){s++;} /*skip whitespace at beginning*/
     while(*s!=0)
     {
      c=*s;
      if( c >= '0' && c <= '9' ){c-='0';}
      else if( c >= 'A' && c <= 'Z' ){c-='A';c+=10;}
      else if( c >= 'a' && c <= 'z' ){c-='a';c+=10;}
      else if( c == ' ' || c == '\n' || c == '\t' ){break;}
      else{printf("Error: %c is not an alphanumeric character!\n",c);break;}
      if(c>=radix){printf("Error: %c is not a valid character for radix %i\n",*s,radix);break;}
      i*=radix;
      i+=c;
      s++;
     }
     return i;
    }
    
    /*
     Those four functions above are the core of chastelib.
     While there may be extensions written for specific programs, these functions are essential for absolutely every program I write.
     
     The only reason you would not need them is if you only output numbers in decimal or hexadecimal, because printf in C can do all that just fine.
     However, the reason my core functions are superior to printf is that printf and its family of functions require the user to memorize all the arcane symbols for format specifiers.
     
     The core functions are primarily concerned with standard output and the conversion of strings and integers. They do not deal with input from the keyboard or files. A separate extension will be written for my programs that need these features.
    */
    
  • Chastity’s Review of the 2026 Amendment 3 in Missouri

    I was asked to make a statement on Missouri’s Amendment 3, which will be voted on in 2026. I believe that this amendment is a “bait and switch” strategy and that, as it is written, it is unacceptable both to Pro-Life people and to Transgender people.

    Myself being Pro-Life but also understanding more about the experiences of Transgender people, believe the amendment would be better written if it were purely about abortion and was not mixed with a ban on Gender Affirming Care.

    You can read about it from the following link, which I will be quoting from.

    https://ballotpedia.org/Missouri_Amendment_3,_Prohibit_Abortion_and_Gender_Transition_Procedures_for_Minors_Amendment_(2026)

    The following is the text as the amendment is written.

    Missouri Amendment 3, the Prohibit Abortion and Gender Transition Procedures for Minors Amendment, is on the ballot in Missouri as a legislatively referred constitutional amendment on November 3, 2026.[1]

    “yes” vote supports amending the Missouri Constitution to:

    • repeal the constitutional right to reproductive freedom, which voters ratified in 2024;
    • prohibit abortions except in cases of “medical emergency, fetal anomaly, rape, or incest,” and permit abortions in cases of rape or incest only through 12 weeks of gestation; 
    • prohibit gender transition surgeries for minors, as well as the prescription or administration of cross-sex hormones or puberty-blocking drugs to minors, with an exception for treatments “unrelated to the purpose of a gender transition;” and make other changes.

    “no” vote opposes amending the Missouri Constitution, keeping the existing constitutional right to reproductive freedom, and not adding provisions that prohibit abortion and gender transition surgeries and procedures.

    I believe that the 3 bulletpoints describing a yes vote are all problematic and that Pro-Life and Pro-Choice people have reasons to oppose them.

    • Point 1 repeals the right to reproductive freedom. I do not oppose reproductive freedom in a legal sense; I just oppose abortion, which is an act of murder that happens after people have already made their reproductive choices. I don’t like the way it is worded. I also believe we need more reproductive freedom, especially when it comes to sterilization that people want and are not able to access because their doctors refuse it or their insurance does not cover it. Those who don’t want children but still want to have sex should have access to expanded sterilization, and this falls under the category of reproductive freedom. Important to freedom is the freedom not to reproduce if you don’t want to.
    • Point 2 is perhaps more concerning because the cases of “fetal anomaly, rape, or incest” allow for abortion based on these broad categories. Fetal anomaly can also be used to abort babies based on their genetic status as intersex, sexual orientation, or other conditions related to things like autism, which are able to be predicted more accurately as science advances. Therefore, if I were to vote yes, I would still be allowing for people like myself to be aborted.
    • Point 3 should just be removed entirely. Gender transition surgeries and hormones have NOTHING at all to do with abortion and should be part of a separate amendment that people can vote on. Whoever wrote this amendment is poisoning politics by forcing people to vote on two unrelated topics.

    I personally plan to vote no on this amendment if I vote at all. I cannot agree to this amendment as it is written, and I also support gender affirming care for everyone, no matter whether those people are transgender, cisgender, or intersex. Honestly, the topics of these surgeries or hormone treatments are for doctors, patients, and parents(in the case of minors) to discuss, because, unlike abortion, which always kills an innocent human being, the vast category of Gender Transition can mean hundreds of different things socially, surgically, or hormonally. I will support no bans on whatever helps people feel aligned with their body more when it does not harm an innocent third party.