koba789, to random
@koba789@misskey.io avatar

#include <sodastream>

mcc, to random
@mcc@mastodon.social avatar

If I build Project1.csproj with msbuild, and the csproj contains an <Import Project="Project2.csproj" />, which of the following are true?

  • <DefineConstants> statements in Project1.csproj will also become defined in Project2.csproj.

  • <DefineConstants> statements in Project1.csproj will also become defined in Project1.csproj.

  • One or both of the above, but which constants are defined depends on where in Project1.csproj the <Import> is placed.

rainer,
@rainer@hachyderm.io avatar

@mcc It is order-dependent--think of it as C . So it'd be as though you plunked the whole project2.csproj into project1 instead of the <Import> line.

Note that it is very unusual to import a .csproj from another one--generally you want to import .props or .targets files that have a subset of common things, not a whole other project--because you'll get that whole other project's source files etc.

puppygirlhornypost, to random
@puppygirlhornypost@transfem.social avatar

love how it's ingrained to always just include of the bat like

puppygirlhornypost,
@puppygirlhornypost@transfem.social avatar

the best, bugless C++ code is written with #include <bits></bits> with ios_base::sync_with_stdio(false); for speed. you know, of course because disabling sync is going to fix everything.

JamesWidman, to random

take of unknown temperature: the concept of an search path (-Ifoo -Ibar ...) that names all header directories of all the libraries you use, all of which may be searched in each individual directive, was a mistake.

in nearly all cases in C/C++, when you include a header (or, in other languages, when you import a module), there is exactly one directory that you want that header to be found in, and so you want it to match with exactly one -I option.

JamesWidman,

so what you really wanted was:

  1. the ability to reference a directory-parameter as in:

"$foo/a.h"

and

  1. for the compiler to check that the argument for that parameter was given on the command line, as in:

% clang++ -I?foo=/path/to/foo

or even:

% clang++ -I?=/path/to/foo
(where the name of the dir-param is given by the last component of the path, which in this case is "foo".)

and the compiler could give a nice diagnostic if there is no -I? option for a given dir-param.

JamesWidman,

as a side benefit, this may also speed up the scan-deps phase slightly, since it's no longer necessary to call stat()/open() more than once when an is processed

JamesWidman,

this would make some traditional includes more verbose tho, as in:

<$std/stdio.h>

but in new languages, you could specify that the first component in an import is a declRef of a directory-parameter:

import std.io; // uses directory-parameter std

import std; // imports all files under the directory for std (which is implicitly defined by default)

JamesWidman,

second thought: if we had this in the C/C++ preprocessor, we wouldn't necessarily need "" or <>, since those are traditionally used to indicate how the compiler searches for the file (and since a use of a directory parameter indicates that only that one directory is searched, we usually wouldn't need any delimiters unless there's a space or something in the filename), so we could have:

std/io.h // uses directory parameter std; equivalent to
std/"io.h"

JamesWidman,

in the (probably?) less-common case where you really want more than one directory to be searched for a given include/import, we could have a separate option for that:

clang++ '--search-path?foo=/d1:/d2'

then:

foo/a.h

would make the compiler search for a.h in /d1 and in /d2 (and not in any other directory).

lanodan, to random
@lanodan@queer.hacktivis.me avatar

We have ps(1) at home.
ps at home: grep . /proc/*/cmdline

lanodan,
@lanodan@queer.hacktivis.me avatar

Heck of a stub mount:

#define _GNU_SOURCE
<a class="hashtag" data-tag="include" href="https://queer.hacktivis.me/tag/include">#include</a> <sys/mount.h>
int
main() {
        return mount("/dev/sda", "/oasis", "ext4", 0, 0);
}

(Wrote it with ed(1), even if I likely could get vis at this point)

whitequark, (edited ) to random
@whitequark@mastodon.social avatar

Can you answer this simple question about the C programming language?

$ cat test.c
<string.h>
<stdio.h>
int main() { printf("%d\n", strlen("\x01c")); }
$ cc test.c && ./a.out

What number does this program print?

lanodan, to random
@lanodan@queer.hacktivis.me avatar
Checking if size of time_t == 8                          : not found
Checking if size of time_t == 16                         : not found
Checking if size of time_t == 32                         : not found
Checking if size of time_t == 64                         : not found
Couldn't determine size of 'time_t'
 * ERROR: sys-libs/talloc-2.4.0::gentoo failed (configure phase):

The heck.

echo $'#include <time.h>n#include <stdio.h>nmain(){printf("%zd", sizeof(time_t));}' | tcc -run - ; echo
8

xyzzy, to retrocomputing in The BASIC programming language turns 60

C

<stdio.h>

int main() {

printf(“Hello, world”);

return 0;

}

C++

<iostream>

int main() {

std::cout << “Hello, world” << std::endl;

return 0;

}

Tolookah, to asklemmy in Remember back in the day in Windows when your mouse would just slide to the left for no reason?

Yeah, the USB ones are an interesting thing, I’m sure writing up the code in an Arduino is trivial these days. Sometime like

jiggler.h mouse.jiggle(excitation,time);

I work with hardware that uses fans though, and a piece of paper flailing in the wind does a great job if I’m running a long test.

lilianne, to random
#include <serialize>

using namespace hsd::format_literals;

template <hsd::usize n="">
struct lian_is_cute 
{
    template <typename chart="">
    static consteval auto pretty_fmt()
    {
        static_assert(
            hsd::is_same<chart char="">::value ||
            hsd::is_same<chart hsd::wchar="">::value,
            "CharT must be either char or hsd::wchar"
        );

        if constexpr (hsd::is_same<chart char="">::value)
        {
            constexpr auto _fmt = 
                "{italic,fg=9}, {ovr}"_fmt;

            return _fmt();
        }
        else
        {
            constexpr auto _fmt = 
                L"{italic,fg=9}, {ovr}"_fmt;

            return _fmt();
        }
    }

    constexpr auto pretty_args() const
        -> hsd::tuple<const char="" lian_is_cute="">>
    {
        return {"Lian is cute", lian_is_cute<n>{}};
    }
};

template <>
struct lian_is_cute<0> 
{
    template <typename chart="">
    static consteval auto pretty_fmt()
    {
        static_assert(
            hsd::is_same<chart char="">::value ||
            hsd::is_same<chart hsd::wchar="">::value,
            "CharT must be either char or hsd::wchar"
        );

        if constexpr (hsd::is_same<chart char="">::value)
        {
            constexpr auto _fmt = 
                "{italic,fg=9}"_fmt;

            return _fmt();
        }
        else
        {
            constexpr auto _fmt = 
                L"{italic,fg=9}"_fmt;

            return _fmt();
        }
    }

    constexpr auto pretty_args() const
        -> hsd::tuple<const char="">
    {
        return {"Lian is cute"};
    }
};

int main()
{
    hsd::println("{ovr}n"_fmt, lian_is_cute<10>{});
}</const></chart></chart></chart></typename></n></const></chart></chart></chart></typename></hsd::usize></serialize>

RE: https://transfem.social/notes/9sh26aezpk690977

LianSirenia, to random
@LianSirenia@transfem.social avatar

Ya'll aught to be careful about how much you say I'm cute or awesome or whatever, keep this up and I might start actually believing it, can't imagine, honestly

KaitlynEthylia,
@KaitlynEthylia@akko.wtf avatar

@ielenia @MikeHar94962844 @LianSirenia Well this one should be pretty cursed

#include <stdio.h>

<a class="hashtag" data-tag="define" href="https://akko.wtf/tag/define" rel="tag ugc">#define</a> MSG "Lian is cuten"

int count() {
  static int c = 0;
  c++;
  return c % sizeof MSG;
}

int main() {
  char* msg = MSG;
  for(;count();msg++)
    putc(*msg, stdout);
  return main();
}
qqq, to programmerhumor in manyThreadsAreBetterThanOne

It doesn’t violate any rules… Imagine both the “speaker” and the “text” are being updated by separate threads. A program that would eventually display the behavior in this meme is simple, and I’m a bit embarrassed to have written it because of this comment:


<span style="color:#323232;">#include <pthread.h>
</span><span style="color:#323232;">#include <stdio.h>
</span><span style="color:#323232;">
</span><span style="color:#323232;">char* speakers[] = {
</span><span style="color:#323232;">    "Alice",
</span><span style="color:#323232;">    "Bob"
</span><span style="color:#323232;">};
</span><span style="color:#323232;">int speaker = 0;
</span><span style="color:#323232;">
</span><span style="color:#323232;">void* change_speaker(void* arg)
</span><span style="color:#323232;">{
</span><span style="color:#323232;">    (void)arg;
</span><span style="color:#323232;">
</span><span style="color:#323232;">    for (;;) {
</span><span style="color:#323232;">        speaker = speaker == 0 ? 1 : 0;
</span><span style="color:#323232;">    }
</span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="color:#323232;">char* texts[] = {
</span><span style="color:#323232;">    "Hi Bob",
</span><span style="color:#323232;">    "Hi Alice, what's up?",
</span><span style="color:#323232;">    "Not much Bob",
</span><span style="color:#323232;">};
</span><span style="color:#323232;">int text = 0;
</span><span style="color:#323232;">
</span><span style="color:#323232;">void* change_text(void* arg)
</span><span style="color:#323232;">{
</span><span style="color:#323232;">    (void)arg;
</span><span style="color:#323232;">    for (;;) {
</span><span style="color:#323232;">        switch (text) {
</span><span style="color:#323232;">        case 0:
</span><span style="color:#323232;">            text = 1;
</span><span style="color:#323232;">            break;
</span><span style="color:#323232;">        case 1:
</span><span style="color:#323232;">            text = 2;
</span><span style="color:#323232;">            break;
</span><span style="color:#323232;">        case 2:
</span><span style="color:#323232;">            text = 0;
</span><span style="color:#323232;">            break;
</span><span style="color:#323232;">        }
</span><span style="color:#323232;">    }
</span><span style="color:#323232;">}
</span><span style="color:#323232;">
</span><span style="color:#323232;">int main(int argc, char* argv[])
</span><span style="color:#323232;">{
</span><span style="color:#323232;">    pthread_t speaker_swapper, text_swapper;
</span><span style="color:#323232;">
</span><span style="color:#323232;">    pthread_create(&text_swapper, NULL, change_text, NULL);
</span><span style="color:#323232;">    pthread_create(&speaker_swapper, NULL, change_speaker, NULL);
</span><span style="color:#323232;">    for (int i = 0; i < 3; ++i) {
</span><span style="color:#323232;">        printf("%s: %sn", speakers[speaker], texts[text]);
</span><span style="color:#323232;">    }
</span><span style="color:#323232;">}
</span>
Bandicoot_Academic, to science_memes in ))<>((

For some context this is one of the winning entries:

<stdio.h>

N(a) “%”#a"$hhn" O(a,b) “%10$”#a"d"N(b) U “%10$.*37$d” G(a) “%”#a"$s" H(a,b) G(a)G(b) T(a) a a s(a) T(a)T(a) A(a) s(a)T(a)a n(a) A(a)a D(a) n(a)A(a) C(a) D(a)a R C(C(N(12)G(12))) o(a,b,c) C(H(a,a))D(G(a))C(H(b,b)G(b))n(G(b))O(32,c)R SS O(78,55)R “\n\033[2J\n%26$s”; E(a,b,c,d) H(a,b)G©O(253,11)R G(11)O(255,11)R H(11,d)N(d)O(253,35)R S(a,b) O(254,11)H(a,b)N(68)R G(68)O(255,68)N(12)H(12,68)G(67)N(67)

char* fmt = O(10,39)N(40)N(41)N(42)N(43)N(66)N(69)N(24)O(22,65)O(5,70)O(8,44)N( 45)N(46)N (47)N(48)N( 49)N( 50)N( 51)N(52)N(53 )O( 28, 54)O(5, 55) O(2, 56)O(3,57)O( 4,58 )O(13, 73)O(4, 71 )N( 72)O (20,59 )N(60)N(61)N( 62)N (63)N (64)R R E(1,2, 3,13 )E(4, 5,6,13)E(7,8,9 ,13)E(1,4 ,7,13)E (2,5,8, 13)E( 3,6,9,13)E(1,5, 9,13)E(3 ,5,7,13 )E(14,15, 16,23) E(17,18,19,23)E( 20, 21, 22,23)E (14,17,20,23)E(15, 18,21,23)E(16,19, 22 ,23)E( 14, 18, 22,23)E(16,18,20, 23)R U O(255 ,38)R G ( 38)O( 255,36) R H(13,23)O(255, 11)R H(11,36) O(254 ,36) R G( 36 ) O( 255,36)R S(1,14 )S(2,15)S(3, 16)S(4, 17 )S (5, 18)S(6, 19)S(7,20)S(8, 21)S(9 ,22)H(13,23 )H(36, 67 )N(11)R G(11)""O(255, 25 )R s(C(G(11) ))n (G( 11) )G( 11)N(54)R C( “aa”) s(A( G(25)))T (G(25))N (69)R o (14,1,26)o( 15, 2, 27)o (16,3,28 )o( 17,4, 29)o(18 ,5,30)o(19 ,6,31)o( 20,7,32)o (21,8,33)o (22 ,9, 34)n(C(U) )N( 68)R H( 36,13)G(23) N(11)R C(D( G(11))) D(G(11))G(68)N(68)R G(68)O(49,35)R H(13,23)G(67)N(11)R C(H(11,11)G( 11))A(G(11))C(H(36,36)G(36))s(G(36))O(32,58)R C(D(G(36)))A(G(36))SS

arg d+6,d+8,d+10,d+12,d+14,d+16,d+18,d+20,d+22,0,d+46,d+52,d+48,d+24,d
+26,d+28,d+30,d+32,d+34,d+36,d+38,d+40,d+50,(scanf(d+126,d+4),d+(6
-2)+18*(1-d[2]%2)+d[4]*2),d,d+66,d+68,d+70, d+78,d+80,d+82,d+90,d+
92,d+94,d+97,d+54,d[2],d+2,d+71,d+77,d+83,d+89,d+95,d+72,d+73,d+74
,d+75,d+76,d+84,d+85,d+86,d+87,d+88,d+100,d+101,d+96,d+102,d+99,d+
67,d+69,d+79,d+81,d+91,d+93,d+98,d+103,d+58,d+60,d+98,d+126,d+127,
d+128,d+129

char d[538] = {1,0,10,0,10};

int main() { while(*d) printf(fmt, arg); }

niconiconi, to random

Why isn't "import things you're going to use into the main namespace first" an accepted code style in C++? Because std:: prefix in std::vector is short enough? Well, in modern C++ with things like std::chrono::duration_cast<std::chrono::microseconds>(t2 - t1)</std::chrono::microseconds>, I suspect "import first" is going to be the new norm soon...

niconiconi,

@Specialist_Being_677 importable modules are coming in C++23 so the "namespace pollution from headers" problem will hopefully no longer be a problem. Until then, #include “header-priv.hpp".

enigmatico, to random
@enigmatico@mk.absturztau.be avatar
lunacb, to random
@lunacb@wetdry.world avatar
JamesWidman, to random

i want to play with zig more, but for me the main stumbling block is the absence of a sane LSP server.

(If you're writing an LSP server and you find yourself implementing your own semantic analysis instead of using the compiler's semantic analyzer, you fucked up.)

JamesWidman,

@dgregor79 So what i want in a case like this is for the LSP server to give the same diagnostic output as the compiler. I neither need nor want to use any LSP features in any region of code that follows an ill-formed directive. In that moment, all i need is to focus on why the include failed and how to fix it.

(and similarly for an ill-formed module import.)

Am i missing something?

  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • rosin
  • thenastyranch
  • cubers
  • ethstaker
  • InstantRegret
  • DreamBathrooms
  • ngwrru68w68
  • magazineikmin
  • everett
  • Youngstown
  • mdbf
  • slotface
  • kavyap
  • anitta
  • GTA5RPClips
  • khanakhh
  • normalnudes
  • osvaldo12
  • cisconetworking
  • provamag3
  • Durango
  • tacticalgear
  • modclub
  • Leos
  • megavids
  • tester
  • lostlight
  • All magazines