A C-style array is written `*T`, much like in C (note: I'm not saying
`T*` and `T[]` are the same type, I know they aren't)
On Sat, Apr 5, 2014 at 6:53 AM, Simon Sapin simon.sa...@exyr.org wrote:
On 05/04/2014 11:39, Vladimir Pouzanov wrote:
The problem is that [extern unsafe fn()] results in
Ended up specifying array size as per Simon's suggestion:
#[link_section=.isr_vector_temp]
#[no_mangle]
pub static ISRVectors: [extern unsafe fn(), ..4] = [
_stack_base,
main,
isr_nmi,
isr_hardfault,
];
Given that table size is an architecture-dependent time constant, it also
adds a tiny
On 05/04/2014 12:00, Corey Richardson wrote:
A C-style array is written `*T`, much like in C (note: I'm not saying
`T*` and `T[]` are the same type, I know they aren't)
*T in Rust is not an array, it is a raw pointer. It may happen to point
to the start of an array that you could unsafely
On 05/04/2014 13:28, Vladimir Pouzanov wrote:
Also tried defining something along the lines of *[extern unsafe fn()],
but I guess size is also required in this case.
This will probably work once we have DST, but it will result in a
fixed-size pointer to an array, rather than the actual array
On 05/04/14 09:23 AM, Simon Sapin wrote:
On 05/04/2014 14:14, Corey Richardson wrote:
Sure, same thing as a C-style array, minus the fact that we don't have
Index implemented for unsafe ptrs.
Sure, but that difference is the important part. It’s idiomatic C to
pretend that a pointer is like
Is it possible to port the following C code to rust?
__attribute__ ((section(.isr_vector)))
void (* const isr_vector_table[])(void) = {
_stack_base,
main, // Reset
isr_nmi, // NMI
isr_hardfault,// Hard Fault
0,// CM3 Memory Management
As you've discovered in bug #13325, dealing with external constants in
static expressions is sometimes a little tricky. I would avoid casting
for now (as happens in the bug) in favor of stronger types. For
example, this compiles and runs for me:
extern {
fn foo();
fn bar();