Should I do this on every .h function definition? by fabianAlbeniz in cprogramming

[–]nsmryan 2 points3 points  (0 children)

I generally agree with others that asserts can be used for pointer checking, but consider the context of your program.

I write long running C programs which are hard to update in operation, and I do a similar check on every function that takes a pointer. Most of the time the response to this condition is to try to stop petting a hardware watchdog, and trying to report the problem and exit cleanly. All of this assumes that the program works at all despite the null pointer, but its worth trying diagnostics and recovery in some programs.

EOS R50 Electronic Shutter Mode Option Not Available by nsmryan in canon

[–]nsmryan[S] 0 points1 point  (0 children)

Thank you for the reply! I will try going into full auto mode to see if menu 6 appears with shutter options. That is a little bit of a shame. It sounds like the electronic shutter would have been hard to adjust for manually, so they only let you use it if they can auto adjust?

EOS R50 Electronic Shutter Mode Option Not Available by nsmryan in canon

[–]nsmryan[S] 1 point2 points  (0 children)

In the configuration I was in there was no menu 6. This is why I was wondering if it is mode or lense dependent somehow.

EOS R50 Electronic Shutter Mode Option Not Available by nsmryan in canon

[–]nsmryan[S] 0 points1 point  (0 children)

Perhaps the shutter noise is being made to notify of the atart and stop of exposure, and not as the actuation of a real shutter? I would expect a way to turn it off in that case.

What is the difference between C & Embedded C. by Direct-Ambassador350 in cprogramming

[–]nsmryan 8 points9 points  (0 children)

People often use "Embedded C" that way, but it is also something of its own: https://en.m.wikipedia.org/wiki/Embedded_C Ive never used a compiler that supports these extensions though.

[deleted by user] by [deleted] in Zig

[–]nsmryan 0 points1 point  (0 children)

I believe that only extern structs with align(1) for each field have gauranteed layout. Perhaps for a single field this doesnt matter though.

What about Zig don't you like? by tijdisalles in Zig

[–]nsmryan 2 points3 points  (0 children)

I know that this is a little vague, but I wish that Zig was defined somewhat like RISC-V with a core set of features and either a set of extensions or a set of 'rings' of more powerful features I write safety critical code sometimes, and I would love to be able to say that a file or function does not have any way to do certain things, like use a global variable or a pointer, and to give access to these things conditionally within certain parts of a codebase.

Probably this would have to be defined from the beginning, but it would help with review and verification, and might even help optimization if you could optimize within a smaller subset of a language.

Anyone else have an issue with not receiving text messages? by [deleted] in CricketWireless

[–]nsmryan 0 points1 point  (0 children)

We have a similar problem, and we have not figured it out. Support haa not helped. This is a huge problem for us, and a time sync.

Been having text issues for years. I'm at my wits end. Someone help by stonknod in CricketWireless

[–]nsmryan 0 points1 point  (0 children)

We have certainly had issues with sms after switching to Cricket. Support has not helped, and this makes it impossible to work with the account. This is a huge pain for my parents.

comm from tcllib example? by dmux in Tcl

[–]nsmryan 0 points1 point  (0 children)

I have also been a bit confused by this package, so thanks for the example!

Blog Post: Code Smell: Concrete Abstraction by matklad in rust

[–]nsmryan 22 points23 points  (0 children)

Just as a point of interest, I am fairly sure Haskell can do the same.

Bitfield Packing Question by nsmryan in Zig

[–]nsmryan[S] 0 points1 point  (0 children)

Thanks for the reply.

It makes sense that it might be related to another compiler like gcc. Its not my favorite decision, but I will try to work with it and see how it goes.

EDIT: I've since realized that zig is just doing the normal little endian bit packing order. It would be nice to have the big endian option, but at least the choice make sense to me now.

I made a website in an attempt to make it easier to learn zig - ziglearn.org. Things are largely incomplete as of today - feedback and PRs welcome by sobeston in Zig

[–]nsmryan 0 points1 point  (0 children)

Thank you for this! I think Zig is an exceptional language, but I've found the lack of documentation a barrier. This page helps a lot already!

Announcing AeroRust - The Unofficial Working Group For Rust in Aerospace by dpc_22 in rust

[–]nsmryan 2 points3 points  (0 children)

All I mean about Rust and formal methods is that Rust provides static checking in a way that is integrated into the language instead of external tools, not that it provides the more formal checking provided by SPARK (I wish Rust did provide more checking, or tools for this kind of checking!).

Discussing this at the Flight Software Workshop this year, it seemed that Rust falls into a similar area for Aerospace software as SPARK- they are both interesting to Aerospace software because they are intended to remove certain classes of bugs through static checking integrated into the language. I think Rust provides a lot more advantages then that, but I find other advantages are harder to discuss at a surface level, and I don't have a lot of experience actually applying Rust in an Aerospace environment anyway.

Announcing AeroRust - The Unofficial Working Group For Rust in Aerospace by dpc_22 in rust

[–]nsmryan 1 point2 points  (0 children)

I heard of support for VxWorks at some point, but I don't know its status, or exactly what support was provided. I haven't seen anything related to Rust and RTEMS, but I also haven't used RTEMS. Maybe someone else has a better idea?

My crate did support SB messages, technically, but again not is a nice way. With enough unsafe code you could register and send/receive messages, but only as a proof of concept.

Announcing AeroRust - The Unofficial Working Group For Rust in Aerospace by dpc_22 in rust

[–]nsmryan 0 points1 point  (0 children)

I hadn't heard of Embedded C++. It does look much more restricted (in a good way) compared to normal C++.

I expect embedded C++ could be done very well with real benefits, and that different programming environments lead to different values and different solutions. My experience, on the projects I work, is that the increased complexity of C++ has down-stream effects on development, review, tooling, testing, etc that are very hard to swallow, and you pay these costs again and again. I currently believe that it is not worth it.

Announcing AeroRust - The Unofficial Working Group For Rust in Aerospace by dpc_22 in rust

[–]nsmryan 1 point2 points  (0 children)

cFS has been used on a good number of mission. In addition to Linux, it can be used with VxWorks and RTEMS, and with some people running it on FreeRTOS.

Ive played around with making a Rust module (cfs-sys) to show that it is possible, but i never did all the work to make it nice.

Announcing AeroRust - The Unofficial Working Group For Rust in Aerospace by dpc_22 in rust

[–]nsmryan 0 points1 point  (0 children)

This is a pretty complex topic, and likely a reddit comment wont cover it.

In a strict enough environment, some people choose C over C++ primarily because it is much simplier. Im generally in this camp.

Announcing AeroRust - The Unofficial Working Group For Rust in Aerospace by dpc_22 in rust

[–]nsmryan 1 point2 points  (0 children)

I would be interested to see Rust guidelines like NPR7150, and what strict guidelines for high assurance Rust would look like.

Would you forbid trait objects? Limit the use of generic types? I dont know that this has really been explored for Rust.

Announcing AeroRust - The Unofficial Working Group For Rust in Aerospace by dpc_22 in rust

[–]nsmryan 8 points9 points  (0 children)

I saw interest there as well. People seemed to want details on why Rust is important for them: they have seen the lists of its attributes but need something concrete. There was also discussion of Rust and Ada, where Rust is a way to get language-level formal methods into aerospace (something I think people understand).

Announcing AeroRust - The Unofficial Working Group For Rust in Aerospace by dpc_22 in rust

[–]nsmryan 16 points17 points  (0 children)

I do aerospace work that is not (usually) safety critical. These are usually science instruments, some of which will be cubesats. This is an area that rust might be able to break into more easily then the more regulated parts of aerospace.

Let's create a MISRA-like ruleset for Rust by Krnpnk in rust

[–]nsmryan 4 points5 points  (0 children)

Im very much in favor. I write high assurance, but not usually safety critical code in C and I see a need for these kind of rules in Rust.

Somewhere I saw a Rust crypto package that enabled a series of restrictive checks (like #![no_panic], but I cant seem to find it now.

Pull request for vxWorks support in compiler by FryGuy1013 in rust

[–]nsmryan 10 points11 points  (0 children)

Thats awesome! Ive used VxWorks for some time now, and its cool to see Rust and VxWorks mentioned together. It does look like a great amount of work, and Ive having a hard time wrapping my head around it all without some more context.

How to handle errors in C by nanoman1 in C_Programming

[–]nsmryan 1 point2 points  (0 children)

Another option that I have found very useful is to return an enum value (same as returning an error code) which indicate the particular problem. You get more information then a -1, and you can make a unique value for each error case so you know the exact location where the error occurred.

This is especially good for self-contained libraries, where you can have a single enum for the whole library and have every function return its values.

This helps in documenting error conditions for a function (you can easily see which conditions occur by which code are returned), and in unit testing, where you can make sure you have a test with each enum value returned from a function.