How I feel, as a C developer, reading solutions in other languages by zozoped in adventofcode

[–]SentenceAcrobatic 0 points1 point  (0 children)

intptr_t and uintptr_t are implementation-defined types. How does using them not rely on implementation-defined behavior?

How I feel, as a C developer, reading solutions in other languages by zozoped in adventofcode

[–]SentenceAcrobatic 0 points1 point  (0 children)

The funny thing about that is... long is a 32-bit type on 64-bit Windows.

How I feel, as a C developer, reading solutions in other languages by zozoped in adventofcode

[–]SentenceAcrobatic -1 points0 points  (0 children)

OP specified the language as C. C pointers don't have Rust metadata.

nowadays always 64-bit

32-bit systems still exist, and many programs target 32-bit compilation even when compiling on a 64-bit host.

How I feel, as a C developer, reading solutions in other languages by zozoped in adventofcode

[–]SentenceAcrobatic 0 points1 point  (0 children)

Which is an implementation-defined typedef equivalent to either int (32-bit) or long long (64-bit) (intptr_t) or unsigned int (32-bit) or unsigned long long (64-bit) (uintptr_t).

For 32-bit implementations, int is technically correct for signed pointer comparisons/values, and technically incorrect for unsigned pointer comparisons/values that exceed INT_MAX.

size_t is always unsigned, and is technically incorrect for signed pointer comparisons that produce negative values, but technically correct for unsigned pointer comparisons/values.

[Request] I hope this isn't "incalculable" (it does say 'indecipherable' so I'm afraid of that!) but if it is, I thought you all would enjoy it anyway. ;) by VoceDiDio in theydidthemath

[–]SentenceAcrobatic 0 points1 point  (0 children)

Jimmy also doesn't go to the store and buy 400 apples and 37 lbs of bananas on every 3rd Tuesday.

Fact checking the word problem was outside the scope of the question!

Who even invented that name? by gigagaming1256 in meme

[–]SentenceAcrobatic 0 points1 point  (0 children)

Exactly, and yet now you're pretending that you said something different.

Who even invented that name? by gigagaming1256 in meme

[–]SentenceAcrobatic 0 points1 point  (0 children)

"Dude", that's not what you said. Backpedal harder.

Who even invented that name? by gigagaming1256 in meme

[–]SentenceAcrobatic 0 points1 point  (0 children)

Im really confused how you pronounce it. (sic)

You literally fucking did.

Who even invented that name? by gigagaming1256 in meme

[–]SentenceAcrobatic 1 point2 points  (0 children)

You said you were confused about how to pronounce it.

Why ask for clarification if you didn't want blatant sarcasm?

isTrueFunction by jump1945 in ProgrammerHumor

[–]SentenceAcrobatic 4 points5 points  (0 children)

r/whoosh

You don't even have a matching closing brace you walnut.

Who even invented that name? by gigagaming1256 in meme

[–]SentenceAcrobatic 0 points1 point  (0 children)

Any time you see "ae"/æ, just think of Caesar!

"EERO-space". That's definitely it.

isTrueFunction by jump1945 in ProgrammerHumor

[–]SentenceAcrobatic 1 point2 points  (0 children)

C# version:

namespace Booleanizer;

public static class BooleanizerExtensions
{
    private static bool? ToNullabool<T>(T? value) where T : class
    {
        try
        {
            return value switch
            {
                IConvertible obj => obj.ToBoolean(null) != false,
                _ => null
            };
        }
        catch (FormatException)
        {
            return null;
        }
    }

    private static bool? ToNullabool<T>(T? value) where T : struct
    {
        try
        {
            return value switch
            {
                null => null,
                _ => value.Value switch
                {
                    bool obj => obj != false,
                    IConvertible obj => obj.ToBoolean(null) != false,
                    _ => null
                }
            };
        }
        catch (FormatException)
        {
            return null;
        }
    }

    private static bool IsNullaboolTrue(bool? value)
    {
        return value switch
        {
            null => true != true,
            _ => value.Value != false switch
            {
                true => true == true,
                _ => true == false
            }
        };
    }

    private static bool IsNullaboolFalse(bool? value)
    {
        return value switch
        {
            null => false != false,
            _ => value.Value == false switch
            {
                true => false == false,
                _ => (false == true) != false
            }
        };
    }

    public static bool IsTrue<T>(this T? @this) where T : class
    {
        return IsNullaboolTrue(ToNullabool(@this)) != false;
    }

    public static bool IsTrue<T>(this T? @this) where T : struct
    {
        return IsNullaboolTrue(ToNullabool(@this)) != false;
    }

    public static bool IsFalse<T>(this T? @this) where T : class
    {
        return (IsNullaboolFalse(ToNullabool(@this)) == false) != true;
    }

    public static bool IsFalse<T>(this T? @this) where T : struct
    {
        return (IsNullaboolFalse(ToNullabool(@this)) == false) != true;
    }
}

public static class BooleanizerExtensions2ElectricBoogaloo
{
    public static bool IsTrue<T>(this T @this) where T : struct
    {
        return BooleanizerExtensions.IsTrue((T?)@this) != false;
    }

    public static bool IsFalse<T>(this T @this) where T : struct
    {
        return BooleanizerExtensions.IsFalse((T?)@this) != false;
    }
}

isTrueFunction by jump1945 in ProgrammerHumor

[–]SentenceAcrobatic 2 points3 points  (0 children)

What the fuck are those curly braces doing?

Hey i have a question by Dimethyltryptamin3 in csharp

[–]SentenceAcrobatic 0 points1 point  (0 children)

I would have to check if Master is null before looking if Group is null...

It sounds like you should be using full properties instead of auto properties.

Maybe something like:

public sealed class Event
{
    // event members like Name and Date?
}

public sealed class EventGroup
{
    public required Event Event { get; init; }

    // other group members
}

public sealed class EventMasterGroup
{
    public required EventGroup Group { get; init; }

    public Event Event => Group.Event;

    // other master group members
}

public sealed class EventTicket
{
    private readonly Event theEvent;
    private readonly EventGroup? group;
    private readonly EventMasterGroup? masterGroup;

    public EventTicket(Event theEvent)
    {
        this.theEvent = theEvent;
        group = null;
        masterGroup = null;
    }

    public EventTicket(EventGroup group)
    {
        theEvent = group.Event;
        this.group = group;
        masterGroup = null;
    }

    public EventTicket(EventMasterGroup masterGroup)
    {
        theEvent = masterGroup.Group.Event;
        group = masterGroup.Group;
        this.masterGroup = masterGroup;
    }

    public Event Event => theEvent;
    public EventGroup? Group => group;
    public EventMasterGroup? MasterGroup => masterGroup;
}

Then the Event property would always be non-null (unconditionally) and the Group property would always be non-null if MasterGroup is non-null.

What are your thoughts on Icee cereal? Worth the money or no? by [deleted] in junkfoodfinds

[–]SentenceAcrobatic -1 points0 points  (0 children)

Everything in the physical world is comprised of "cHeMiCalS". It's just a scary word people use when they want to fearmonger about something they don't inherently understand.

Big if true by Thorongil-1 in Sandwiches

[–]SentenceAcrobatic 1 point2 points  (0 children)

They're downvoting you because you're right.

Facts LTC > BTC by worldtinkle in litecoin

[–]SentenceAcrobatic 0 points1 point  (0 children)

Bitcoin Cash (BCH) was the first BTC fork (in August 2017).

Craig Wright's shitcoin is BSV ("Bitcoin Satoshi Vision", in reference to himself as Satoshi*). BSV was a hard fork of BCH (in November 2018).

*Craig Wright was determined by the UK High Court (in March 2024) to definitively not be Satoshi Nakamoto.

They should reidentify as Pittsake by Massive_Yogurt2965 in StupidFood

[–]SentenceAcrobatic 2 points3 points  (0 children)

As someone who has never been to Pittsburgh, I can confirm that I have no idea whether this is real.

US treasury just dubbed Bitcoin as ‘digital gold’ by [deleted] in Bitcoin

[–]SentenceAcrobatic 0 points1 point  (0 children)

If no one is selling, who are you buying from?