ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
JinShil has joined #zig
sagecode has joined #zig
durandu has joined #zig
<JinShil>
Does Zig have any way to model bitfields as fields/properties rather than methods? Thinking about modeling memory-mapped IO registers in a microcontroller.
<andrewrk>
JinShil, yes
<andrewrk>
hmm looks like I need to add the docs for packed structs
<bheads____>
is there a reason why argument list isn't just a const []u8[]?
<andrewrk>
JinShil, ah that's nice
<andrewrk>
bheads_, yes. 2 reasons:
<andrewrk>
1. posix provides `[][*]null u8`. to convert that into `[]const []const u8`, we would have to allocate memory
<andrewrk>
2. Windows provides GetEnvironmentStringsW which returns `[*]null u16`. to convert that into `[]const []const u8` we would have to allocate memory
<andrewrk>
so if you use std.os.argsAlloc and pass an allocator, you get back a `![]const []u8`
<andrewrk>
and that works on all platforms
<andrewrk>
JinShil, I believe that MajorLag1 is working on a field tag proposal, which could be used to add bit offset annotations to packed structs and could then be verified at comptime
<bheads____>
Okay I see that function now, std is a little tricky to find things (or the proper thing to todo)
<bheads____>
also might want to checkout CommandLineToArgvW
<andrewrk>
bheads_, I totally agree. that's going to be an ongoing issue until we have autogenerated docs
<JinShil>
andrewrk, Thanks, I'll be watching for it.
<andrewrk>
I've seen that. we have a correct implementation of CommandLineToArgvW in std
<andrewrk>
bheads_, ...which is used by std.os.argsAlloc
<MajorLag1>
Yeah, I'm still thinking about that proposal. I tried a bunch of ideas using existing language features to do what I wanted and they were all pretty unweildy. Now I'm thinking through the proposal to see if there's a language feature that'll get us there with a little tweaking before I go all out and propose a new sigil or builtin something like that.
<bheads____>
looks like zig is splitting it, not api, but thats okay
<MajorLag1>
It might be as simple as allowing void fields to have duplicate names. Or having typeInfo know the name used for a type alias.
hoppetosse has quit [Ping timeout: 260 seconds]
kristate has joined #zig
kristate has quit [Ping timeout: 260 seconds]
<andrewrk>
bheads_, did you find a difference between zig's split behavior and CommandLineToArgvW?
sagecode has quit [Ping timeout: 264 seconds]
<bheads____>
I havn't seen a difference, was just pointing out that the winapi has a function for that. Not sure is the windows version does anything special.
<andrewrk>
right now the policy about calling windows APIs are: avoid calls for things that we don't need the system to do. for example, unicode decoding and encoding. there is no reason to introduce an external dependency for this
<andrewrk>
this has the best performance, the fewest dependencies (and thus installation headaches), and allows using the functionality at compile-time
<bheads____>
sounds good, I didn't see it as a problem :)
<bheads____>
would zig ever what to support switching on strings?
<MajorLag1>
wait, did I miss allocations working at comptime?
<MajorLag1>
oh wait, you were just talking about splitting the arg string, not retrieving it.
<andrewrk>
bheads_, before I answer that question I want to explore what it looks like to implement perfect hashing at comptime in userland
<bheads____>
but your open to the idea? cause thats a feature from D I miss
<andrewrk>
sure I'm open to the idea. but if there is not a really satisfying way to implement it reliably and optimally, then it would fall into the category of nice-to-haves that zig is missing in order to stay simple
<bheads____>
I am down with that
<andrewrk>
e.g. if it encourages people to rely on it instead of using enums, that's a problem. at least with an if-else chain of comparisons, the performance looks closer to what it really is
<andrewrk>
on the other hand if we figure out a killer perfect hashing solution or some other satisfying implementation, then it might make sense
<bheads____>
yeah, I just ended up with lots of else ifs mem.eql
<bheads____>
does anyone watch Jonathan Blow's Jai video at all? What do you think about it not using parans in if statements?
<MajorLag1>
I watch Jon all the time. Like right now for example. My personal opinion is that if statements without parens are slightly harder to read, but it isn't a big deal.
<MajorLag1>
I also prefer Allman style, so I'm weird like that.
<bheads____>
yeah thats what I felt, it seemed really easy to miss understand that condition from the block
<JinShil>
Suppose I wanted to use std.fmt with an ARM cortex-M microcontroller, and I wanted the output to be sent over a UART (serial port). I suspect there's some code in the std library that needs to be ported. Is there a platform abstration layer/file somewhere?
<thither>
Does zig hold a different niche from rust? I saw andrewrk's video on YouTube from March and zig was compared against many systems programming languages (and some other types of languages), but rust was not mentioned.
<thither>
One thing that really caught my attention was the ability to very quickly interface with existing C libraries - which is something rust doesn't do so well.
<thither>
(the quick part - once the wrapper is written all is well)
<thither>
donpdonp, thanks
<JinShil>
thither, Andrew did briefly discuss Rust in that video during the Q & A
<thither>
JinShil, ah, okay. I'll go back and check the Q&A out
<donpdonp>
my own take on why zig is that zig is a "better C". ie i can actually make the leap from knowing some C to seeing how zig improves on it.
<donpdonp>
rust's pointer ownership on the otherhand strikes me like learning german while flying upside down.
<thither>
donpdonp, does zig offer the "fearless concurrency" that rust claims to have? Ownership is part of that.
<donpdonp>
i read somewhere that zig has some coroutine support but its not documented yet. afaik 'fearless concurrency' would be a high level feature to build with zig
<donpdonp>
im happy with a sane type system, arrays that know their length, and non-nullable pointers. that alone should move the industry forward :)
<donpdonp>
so to compare with go, zig has coroutines but not channels for thread message-passing. maybe thats coming, i dont know.
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<donpdonp>
there's probably a clib that does both. (actors)
<JinShil>
My question was a bit mor general though. I'm thinking about a cohesive way to port the standard library to a currently unsupported platform. The code in std.os looks right, but I'd have to experiment to know for sure. At least I know where to look and have some idea of what to look for and how to proceed. Thanks.
tiehuis has quit [Quit: WeeChat 2.1]
<JinShil>
I think Zig's doing a lot of things right. It's not exactly what I'm looking for right now, but I think it has a bright future.
<GitHub99>
zig/master bf3d1c1 Jimmi HC: Allow access of array.len through a pointer
donlzx has joined #zig
hoppetosse has quit [Ping timeout: 240 seconds]
davr0s has joined #zig
<JinShil>
Is there no function overloading in Zig?
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
JinShil has quit [Quit: Leaving]
donlzx has quit [Remote host closed the connection]
davr0s has joined #zig
Jan__ has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
JinShil has joined #zig
davr0s has joined #zig
<nc-x[m]>
JinShil: AFAIK no.
<nc-x[m]>
That is one thing I would love to see in Zig. IMO it makes code easier to write. Also GoToDefinition in editors can help with readability issues if anyone has them
very-mediocre has joined #zig
frmdstryr has quit [Ping timeout: 276 seconds]
frmdstryr has joined #zig
<very-mediocre>
Is there a way to check if a variable is `undefined`? The `==` operator isn't supported for `undefined`
<very-mediocre>
i.e. var x = undefined; if (x == undefined) x = 1;
tiehuis has joined #zig
<tiehuis>
very-mediocre: no, undefined is just to specify that the value should not be initialized on declaration
<tiehuis>
it still has a value, its just indeterminate until you actually explicitly set it
<tiehuis>
if you need a way to have a possibly empty type you'd need to use a nullable
<very-mediocre>
I see, thanks.
<very-mediocre>
FYI things like `const x = undefined` make no sense
<very-mediocre>
(I'm sure you guys know that already)
<tiehuis>
yeah, that is never used as fasr as i can see any code besides one test case in the compiler
tiehuis has quit [Quit: WeeChat 2.1]
sagecode has joined #zig
king_button has joined #zig
<MajorLag1>
I dunno, doesn't one of the crypto libraries out there use uninitialized memory as part of its seeding process? I vaguely recal that some ambitious programmer used valgrind on it and eliminated a bunch of warnings at the cost of causing every debian install in the world to generate the same first ssh key, or something. In that case something like `const x: u32 = undefined;` makes sense at least.
<MajorLag1>
JinShil, nc-x[m], personal opinion: I don't like the idea of relying on fancy editor features for readabilitty.
<king_button>
Wow the number of patreons have increased enormously since Andrew posted about quitting his job to work on Zig
<nc-x[m]>
Yeah I can agree that readability is subjective but i would prefer function() to function1arg(), function2arg() etc
<JinShil>
Yeah, I think function overloading improves readability because you don't have to be so redundant; you can see by the nature of the call what's going on, you don't need to specify it in the name to disambiguate it.
<very-mediocre>
MajorLag: good point, I've read about that as well, although I'm not a crypto guy. Seems unsafe to me!
<very-mediocre>
MajorLag1 rather*
<king_button>
Loci, a language that looks just like C++ but improves on it, also decided against method overloading. What's clear in any case is that C++ has too much implicit conversion which makes method overloading a pretty bad idea.
tiehuis has joined #zig
<king_button>
But I do like method overloading myself
<king_button>
Why did I just call it method overloading instead of function overloading? Oh well.
<MajorLag1>
Function overloading has some fair arguments in its favor, but I will point out that you can do something similar in Zig today using var and varargs, you just have to handle it more manually.
<JinShil>
Yeah, I saw the example with var, and even played with it, so actually Zig does have function overloading, just in a different way.
<bheads_>
Tuples will improve that situation as well
Jan__ has quit [Quit: Page closed]
<very-mediocre>
Is there currently an equivalent to the preprocessor, i.e. sections that should only run in debugmode?
<bheads_>
anyone run intol a compile issue with deuplicate symbol: _start
Braedon has joined #zig
<Braedon>
Guess who just spelt 'kernel' as 'kernal' and had to physically turn on a windows computer and run to see the error *facepalm*
<MajorLag1>
Been reading too many C64 manuals lately?
king_button has left #zig ["Leaving"]
<bheads_>
anyone had an issue with: duplicate symbol: _start in gcc Scrt1.0 and boostrap.zig
<bheads_>
hummm its realted to using the heap.c_allocator
<tiehuis>
what is your command-line invocation?
<bheads_>
zig run src/main.zig
<tiehuis>
okay, add '--library c'
<bheads_>
makes sense, but the error message is miss leading
<tiehuis>
i think there was a reason it wasn't more specific here, can't recall
tiehuis has quit [Quit: WeeChat 2.1]
Braedon has quit [Ping timeout: 260 seconds]
mahmudov has joined #zig
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
king_button has joined #zig
<king_button>
How do I exit early out of a program?
<bheads_>
std.os.exit(0)
hoppetosse has joined #zig
noonien has joined #zig
clownpriest has joined #zig
davr0s has joined #zig
tridactyla has quit [Ping timeout: 248 seconds]
<king_button>
I can't seem to create an enum of signed integers even when explicitly specifying enum(i32), I just get "expected unsigned integer, found i32"
<king_button>
btw how do you port C enums over manually?
<bheads_>
I think you need an extern enum
cmc has joined #zig
cmc has quit [Quit: Page closed]
dsn has joined #zig
<bheads_>
is there are string to int function in the stdlib?
<bheads_>
nm found parseInt in std.fmt
frmdstryr has quit [Ping timeout: 268 seconds]
frmdstryr has joined #zig
hoppetosse has quit [Ping timeout: 268 seconds]
JinShil has quit [Quit: Leaving]
Ichorio has joined #zig
hoppetosse has joined #zig
\\\\\\\\\\\ has quit [Quit: WeeChat 2.1]
<andrewrk>
bheads_, I think there may be some things we can do to assist in that situation, but the fundamental nature of linking object files together sadly leaves it ambiguous why a symbol is missing, so there's a limit to how helpful the error messages can be
sagecode has quit [Ping timeout: 245 seconds]
<andrewrk>
this is why - for non libc builds - you can put `extern "libname"`
<andrewrk>
this lets zig know where we expect to find all the functions, which lets us have more useful diagnostics as well as cross compile for windows with no SDK
Anilm3 has joined #zig
<bheads_>
I was just confused why importing the c_allocator caused the error, that was all. It makes sense now
<bheads_>
does anyone what a thread safe logging library?
<bheads_>
wow I cannot type, does any one *have* a logging library?
frmdstryr has quit [Ping timeout: 256 seconds]
frmdstryr has joined #zig
hoppetosse has quit [Remote host closed the connection]
hoppetosse has joined #zig
clownpriest has quit [Ping timeout: 256 seconds]
<very-mediocre>
Is there a standard library reference anywhere? I'm interested in things like dynamic array concatenation (wondering if I should roll my own)
<andrewrk>
very-mediocre, not yet, you'll have to resort to grep
clownpriest has joined #zig
<very-mediocre>
Alright. Namespaces match the directories like in golang, right?
<andrewrk>
not necessarily
<andrewrk>
you could start by looking at std/index.zig to see what all is available
<very-mediocre>
will do. ty
<andrewrk>
very-mediocre, for what it's worth, I believe that the functionality you described does not exist in std lib
<very-mediocre>
I see
<very-mediocre>
I'll consider rolling my own at some point but I'm still a noob, I've yet to work out the heap allocation story (e.g. C++ "new")
<andrewrk>
you'll want to get a *std.mem.Allocator and then call allocator.alloc(Type, count)
<very-mediocre>
andrewrk: accessing the `struct.z` gives the error
<very-mediocre>
if `get_struct` is changed to return `SomeStruct` instead of `?SomeStruct` then the error doesn't occur
<very-mediocre>
I suspect there's a reason for this but I'm unclear why `?SomeStruct.?z` is guarded against but not `SomeStruct.?z`
<very-mediocre>
also `?SomeStruct.x` is fine
<very-mediocre>
OK, maybe I'm stupid
<very-mediocre>
it just occurred to me this might be like the struct needs to exist before accessing one of its fields... but then `?SomeStruct.x` should complain too
<very-mediocre>
sorry for spamming, thinking out loud a bit.
<andrewrk>
very-mediocre, try the code I left in a gist comment
<very-mediocre>
It works, but then why does `?SomeStruct.x` not complaing
<very-mediocre>
should it not be the same error? (Need to handle that SomeStruct might be null before attempting any field access)
<andrewrk>
show me an example where it works but it shouldn't?
<very-mediocre>
posted on gist
<very-mediocre>
It lets you access .x and.y (non-nullable fields) even though I'm not handling that the struct itself may be null
<andrewrk>
I get `error: type '?SomeStruct' does not support field access` for both of them
<very-mediocre>
huh :|
<very-mediocre>
I think I made a mistake somewhere
<very-mediocre>
ok
<very-mediocre>
my apologies
<andrewrk>
no worries
<very-mediocre>
it's complaining about `?SomeStruct.x`
<very-mediocre>
I was so sure it wasn't complaining in that scenario
<very-mediocre>
sorry! :]
<andrewrk>
there are quite a few known bugs right now - I don't blame you for double checking assumptions
<andrewrk>
no worries
<bheads_>
I was wondering what people are using (editor/ide) to code zig in?
<bheads_>
Right now I am just using ranger and vim
<andrewrk>
I use vim. I think tiehuis uses vscode. some folks use spacemacs or emacs or something like that
<very-mediocre>
bheads_ i'm using vscode
<bheads_>
andrewrk, do you have a vim syntax file for zig?
<andrewrk>
it even supports running zig fmt on save
<bheads_>
amazing
king_button has joined #zig
davr0s has joined #zig
<king_button>
I have a question about function pointers. Is there no way to call them without this syntax: ptr.*()
<bheads_>
highlighting is always such a big difference
<king_button>
because lots of c libraries like opengl and vulkan want to be called through function pointers, at least for best performance (in the case of vulkan anyways).
<andrewrk>
king_button, you can call function pointers with fn_ptr()
<king_button>
I get "type '*fn() void' not a function" - I might be doing something wrong?
<andrewrk>
I might need to open an issue for this - fn() is already a pointer
<andrewrk>
`*fn() void` is a double pointer
<king_button>
ah
<king_button>
whoops
<king_button>
makes sense
<bheads_>
andrewrk, is there a way to get a calling functions file name and line number? Writting a simple runtime logger
<andrewrk>
bheads_, how this will work: fn log(location: var, comptime format: []const u8, args: ...) { // ...
<andrewrk>
at the callsite: log(this, "blah");
<andrewrk>
oops, you need `comptime` on location.
<andrewrk>
and then - and this is not implemented yet -you'll be able to extract source file, line, column, and more info from the location parameter
king_button has quit [Remote host closed the connection]
<bheads_>
okay so the idea is this has the comptime info
king_button has joined #zig
<andrewrk>
yes
<bheads_>
but its not implemented, so I can wait on that
<andrewrk>
`this` is a bit of an experiment right now. I'll probably change it to `@this()` and make the semantics more well-defined
<bheads_>
gotcha
<andrewrk>
but the idea is that it references a particular scope at comptime. so you'd be able to find out lots of things about that scope, including file, line, column
<bheads_>
nice
<bheads_>
I wonder if @scope() would be less confusing for people migrating
<andrewrk>
I realized it's actually AST node, not scope, so even more specific would be @thisAstNode()
<andrewrk>
I can't help but wonder if there is a better way to log out a reference to a particular line of code
<bheads_>
so really it would have all the info in the node
<andrewrk>
for example the log function could be marked "noinline" and then collect the return address (which is a single usize). That can go in the log message, with also some info to identify the source code version (perhaps the commit hash). Then later when analyzing log files, you could use debug info to translate the return address into file, line, column
<andrewrk>
this would avoid bloating the binary with source file and line number information converted to strings
Anilm3 has joined #zig
<bheads_>
interesting, but I doubt NOC wants to translate log files
<andrewrk>
yeah that's fair. what's NOC/
<andrewrk>
?
<bheads_>
network operations center
<andrewrk>
I see
<bheads_>
IT folks
<bheads_>
also, not fun when I get sent a 10gig gz of logs for the last 30 days looking for an error
<bheads_>
lol
<andrewrk>
yeah. the binary bloat may be worth the log analysis benefit
<bheads_>
besides I would think the comptime format strings would be just as bad
<andrewrk>
comptime format strings don't make it into the binary
<andrewrk>
sorry that's not true. they will make it into the binary because the code references them at runtime, e.g. "foo: {}" - the runtime code will have a const slice of "foo: "
<bheads_>
right, and is it a FSM that it gets turned into?
<andrewrk>
it gets turned into a linear series of function calls
<andrewrk>
thither, idea being that if you have a 10 million line codebase, and you update 1 function, all that should have to happen is updating 1 tiny .o file which contains that function, and re-linking. potentially even using .so files instead of .o sometimes to skip the re-linking step (really, it means doing the linking step at runtime lazily)
<thither>
andrewrk, sounds like it'll be faster than rustc :P
very-mediocre has quit [Ping timeout: 260 seconds]
king_button has quit [Remote host closed the connection]
king_button has joined #zig
zovt has joined #zig
<zovt>
can I create a stack-allocated array with length computed at runtime?
<zovt>
or must I allocate for that?
<zovt>
const word = dict_iter.next() ?? unreachable;
<zovt>
whoops
king_button has quit [Remote host closed the connection]
<andrewrk>
zovt, if the value is known at runtime, then heap allocation is almost certainly the correct place for the memory
<rom16384>
I've just cloned and tried to build zig on a mac, but the last test step fails with "c.zig:1:9: error: C import failed, 'inttypes.h' file not found". Is the build broken?
<andrewrk>
rom16384, sounds like you have a working zig build, but the tests that test interaction with libc are failing, because you do not have libc headers available on your system
<rom16384>
ok
<andrewrk>
so you can do everything except --library c and @cImport
king_button has quit [Remote host closed the connection]
king_button has joined #zig
<andrewrk>
rom16384, do you have gcc or clang available, and can you build hello world with one of them?
<rom16384>
I'm using clang and I have xcode installed
<andrewrk>
where is clang finding libc? can you look for stdlib.h on your system?
<rom16384>
Under the XCode dirs, for example: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1/tr1/stdlib.h
<rom16384>
I forgot to install the latest version of the command line tools, I'm doing that now
<andrewrk>
I think that should solve it
<rom16384>
yeah
<andrewrk>
however we may consider trying to look for libc under xcode paths
<andrewrk>
if it works, I don't see why not
<rom16384>
What is the recommended compiler on a mac, gcc?
<andrewrk>
for compiling zig stage 1?
<rom16384>
yes, I guess
<andrewrk>
it must be the same compiler as used to build llvm & libclang
return0e has quit [Read error: Connection reset by peer]
<rom16384>
ok, got it
<andrewrk>
so, probably whatever is your default system compiler|
return0e has joined #zig
<andrewrk>
note that zig does not depend on a c compiler
<andrewrk>
it does not depend on a system C compiler being installed - only the libc files, and even then only for --library c
<andrewrk>
at runtime anyway, of course zig stage 1 must be built from source
king_button has quit [Remote host closed the connection]
hoppetosse has joined #zig
king_button has joined #zig
<zovt>
rom16384: I think you can `brew install zig` if you just want 0.2.0
<zovt>
at least that worked when I tried it yesterday, ymmv
<rom16384>
I just saw that zovt on the page, I don't know how I could have missed it
<zovt>
not sure if that will pull any needed dependencies though
<zovt>
nice :)
<rom16384>
Anyway after updating XCode's command line tools the tests are running
king_button has quit [Remote host closed the connection]
<andrewrk>
I would recommend master branch though. at this point 0.2.0 is using incorrect syntax and there have been 534 commits to master since 0.2.0
<zovt>
whew, crazy
<rom16384>
andrewrk: That's why I trying going straight for the repo
<zovt>
andrewrk: do you maintain a log of syntax changes that happen somewhere?
<andrewrk>
zovt, I've been putting that off until I write release notes
<andrewrk>
but maybe it makes sense to write those notes as breaking things happen
<zovt>
is 0.3.0 getting cut soon?
<andrewrk>
I'll at least start doing that after 0.3.0 (scheduled for mid-september)
<zovt>
nice
hoppetosse has quit [Ping timeout: 255 seconds]
<thither>
Who funds zig?
<andrewrk>
it's crowd funded
<clownpriest>
is there a way to tell the compiler to just do arithmetic with overflows on all operations in a block (or just in a function)?
<zovt>
tip for anyone hacking zig in emacs: rust-mode tends to work pretty well
<clownpriest>
without having to call @mulWithOverflow or @addWithOverflow on each operation
<MajorLag1>
oh boy, pointer reform is done. that's probably worth a blog post. something like "why we fundamentally changed our pointer syntax".
______ has joined #zig
______ has quit [Client Quit]
<andrewrk>
MajorLag1, (semi-joking) I'll put it in line behind coroutines
<andrewrk>
MajorLag1, also to be clear I left null terminated pointers for another issue
hoppetosse has joined #zig
<clownpriest>
is there a way to have debug.warn() output an int in hex format?
<andrewrk>
"{x}"
rom16384 has quit [Quit: Leaving.]
hoppetosse has quit [Ping timeout: 264 seconds]
<clownpriest>
cool thanks
<zovt>
are you guys using any cpp features in the stage1 compiler? From the code I've seen it all looks very c-like
<andrewrk>
templates, llvm API, and libclang API
<zovt>
gotcha
clownpriest has quit [Ping timeout: 276 seconds]
bheads__ has joined #zig
jjido has joined #zig
Ichorio has quit [Ping timeout: 260 seconds]
rom16384 has joined #zig
return0e has quit [Read error: Connection reset by peer]
<MajorLag1>
andrewrk, probably best to wait until that's in then.
return0e has joined #zig
hoppetosse has joined #zig
rom16384 has quit [Quit: Leaving.]
clownpriest has joined #zig
<zovt>
andrewrk: is discussion about whether or not to support hard tabs to take place specifically on https://github.com/ziglang/zig/issues/544 or can I run some ideas by you here?
<andrewrk>
please do it on 544
<zovt>
sounds good
<thither>
andrewrk, do you work on zig full time?
<andrewrk>
thither, yes, as of yesterday
<thither>
:O
<thither>
Congratulations!
<andrewrk>
thank you. we can celebrate once I'm not living off of savings :)
adagio_ has joined #zig
quc has quit [Ping timeout: 245 seconds]
noonien has quit [Quit: Connection closed for inactivity]
<GitHub116>
[zig] tiehuis opened pull request #1081: Add arbitrary-precision integer to std (master...bigint) https://git.io/vhghr
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
willllll has joined #zig
<GitHub97>
[zig] isaachier opened pull request #1082: Fix error handling in Buffer::fromOwnedSlice (master...buffer-fixes) https://git.io/vh2ef
<zovt>
andrewrk: if / when do you plan on phasing out the stage1 compiler and focusing solely on the self-hosted one?
davr0s has joined #zig
<willllll>
is there an easy way to print a C string? I'm trying warn("{}", c"whatever"), but (understandably) just getting the bytes
<andrewrk>
zovt, the stage1 compiler will forever be maintained
<andrewrk>
however there will be a subset of functionality that it does not need to support. it only has to be able to build stage2
<andrewrk>
willllll, hm I think we need to add another format character for that use case, perhaps warn("{c}", c"whatever");
<andrewrk>
it would be pretty straightforward, just need to do it
<willllll>
Hah, I didn't intend to suggest a language feature ;) , do you think in the meantime using c's printf or something would be the way? I'm not doing anything serious
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<andrewrk>
willllll, it wouldn't be a language feature, just a small code addition to the state machine in the std.fmt.format function
<GitHub174>
zig/master 1a9d2f3 isaachier: Fix error handling in Buffer::fromOwnedSlice (#1082)
davr0s has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<MajorLag1>
willllll: There's a function in std.c to get a `[]const u8` from a c string. It doesn't allocate or anything, it just gives you a slice covering the string's bytes.
<andrewrk>
oh yeah, that's right. I think that's the recommended way to print c strings.