s_
not m_
. m_
is reserved for member variables of a class or struct. The two variables m_Verified
and m_VerifyTries
should be member variables of the class CMenus
in this case. the output ofpGet->Result(cChar, cSize);
is never used anywhere and you don't actually need the result so just remove that. (You can also look at CHttpRequest::Result
s intended usage if you want to since how you use it is not correct, you can find an example here: https://github.com/ddnet/ddnet/blob/9be9a902e7f3e9cd5418823ef88b70e32dd797af/src/engine/shared/http.cpp#L427-L433.). A return
statement is not necessary at the end a void type function. Also move auto Time = std::chrono::duration_cast<std::chrono::milliseconds>(time_get_nanoseconds() - StartTime);
into the else
block and mark it const
since it is never modified and is not used outside of the else
block. Don't forget to format your code with something like clang-tidy and squash your commits. maybe i missed some things or said smth wrong, correct me if so (edited)s_
not m_
. m_
is reserved for member variables of a class or struct. The two variables m_Verified
and m_VerifyTries
should be member variables of the class CMenus
in this case. the output ofpGet->Result(cChar, cSize);
is never used anywhere and you don't actually need the result so just remove that. (You can also look at CHttpRequest::Result
s intended usage if you want to since how you use it is not correct, you can find an example here: https://github.com/ddnet/ddnet/blob/9be9a902e7f3e9cd5418823ef88b70e32dd797af/src/engine/shared/http.cpp#L427-L433.). A return
statement is not necessary at the end a void type function. Also move auto Time = std::chrono::duration_cast<std::chrono::milliseconds>(time_get_nanoseconds() - StartTime);
into the else
block and mark it const
since it is never modified and is not used outside of the else
block. Don't forget to format your code with something like clang-tidy and squash your commits. maybe i missed some things or said smth wrong, correct me if so (edited)pub trait ArchitectureClone {
fn clone_box(&self) -> Arch;
}
pub trait Architecture: ArchitectureClone {
...
}
pub type Arch = Box<dyn Architecture>;
impl<T> ArchitectureClone for T
where
T: 'static + Architecture + Clone,
{
fn clone_box(&self) -> Arch {
Box::new(self.clone())
}
}
impl Clone for Arch {
fn clone(&self) -> Self {
self.clone_box()
}
}
the most "advanced" rust code I've written so far just to be able to clone trait object (edited)r7
register malloc
xdcl_input_fifo fifofile.fifo
in your config and write to that file from your script+jump
?pub trait ArchitectureClone {
fn clone_box(&self) -> Arch;
}
pub trait Architecture: ArchitectureClone {
...
}
pub type Arch = Box<dyn Architecture>;
impl<T> ArchitectureClone for T
where
T: 'static + Architecture + Clone,
{
fn clone_box(&self) -> Arch {
Box::new(self.clone())
}
}
impl Clone for Arch {
fn clone(&self) -> Self {
self.clone_box()
}
}
the most "advanced" rust code I've written so far just to be able to clone trait object (edited)Arc<dyn Architecture>
insteadArc<dyn Architecture>
instead Rc
, my program is not multi threaded.clone()
.clone()
Rc<>
is usually preferablefn main() {
let val = Rc::new(0x45u8);
foo(val.clone());
}
fn foo(mut r: Rc<u8>) {
Rc::get_mut(&mut r); // can
r.get_mut(); // cant
}
fn main() {
let val = Rc::new(0x45u8);
foo(val.clone());
}
fn foo(mut r: Rc<u8>) {
Rc::get_mut(&mut r); // can
r.get_mut(); // cant
}
&mut Rc<T>
as an argument, not &mut self
&mut Rc<T>
as an argument, not &mut self
Rc::get_mut
Rc
was the wrong suggestion to you. I thought dyn Architecture
doesn't change after it was created?Rc::get_mut
Rc
was the wrong suggestion to you. I thought dyn Architecture
doesn't change after it was created? &mut self
, because it has buffer which it writes generated code to (edited)Rc
was probably the wrong suggestion to you, unless you want ot make that buffer a parameterno_std
FixedBitSet
is a simple fixed size set of bits. ZCZC
WEPA40 PHEB 080908
TSUPAC
TSUNAMI MESSAGE NUMBER 2
NWS PACIFIC TSUNAMI WARNING CENTER HONOLULU HI
0906 UTC THU AUG 8 2024
...PTWC TSUNAMI INOFRMATION STATEMENT SUPPLEMENT
**** NOTICE **** NOTICE **** NOTICE **** NOTICE **** NOTICE *****
THIS MESSAGE IS ISSUED FOR INFORMATION ONLY IN SUPPORT OF THE
UNESCO/IOC PACIFIC TSUNAMI WARNING AND MITIGATION SYSTEM AND IS
MEANT FOR NATIONAL AUTHORITIES IN EACH COUNTRY OF THAT SYSTEM.
NATIONAL AUTHORITIES WILL DETERMINE THE APPROPRIATE LEVEL OF
ALERT FOR EACH COUNTRY AND MAY ISSUE ADDITIONAL OR MORE REFINED
INFORMATION.
**** NOTICE **** NOTICE **** NOTICE **** NOTICE **** NOTICE *****
NOTE UPDATED MAGNITUDE.
PRELIMINARY EARTHQUAKE PARAMETERS
---------------------------------
* MAGNITUDE 7.1
* ORIGIN TIME 0742 UTC AUG 8 2024
* COORDINATES 31.8 NORTH 131.7 EAST
* DEPTH 33 KM / 20 MILES
* LOCATION KYUSHU JAPAN
EVALUATION
----------
* AN EARTHQUAKE WITH A PRELIMINARY MAGNITUDE OF 7.1 OCCURRED IN
KYUSHU, JAPAN AT 0742 UTC ON THURSDAY AUGUST 8 2024.
* BASED ON THE PRELIMINARY EARTHQUAKE PARAMETERS... HAZARDOUS
TSUNAMI WAVES ARE POSSIBLE FOR COASTS LOCATED WITHIN 300 KM
OF THE EARTHQUAKE EPICENTER.
"imei_number": false
YEStype Product struct {
IMEINumber bool `json:"imei_number"`
}
null
sometimes, idk whenas
are bitcasts in rusttry_into
/try_from
or into
/from
as appropriateusize::from(u32)
does not work in rust (I don't like it, IMO, they should add it)usize::from(u64)
on 64-bit platforms)#[cfg(target_pointer_width = "16")]
impl usize {
uint_impl! {
Self = usize,
ActualT = u16,
SignedT = isize,
NonZeroT = NonZero<usize>,
BITS = 16,
MAX = 65535,
rot = 4,
rot_op = "0xa003",
rot_result = "0x3a",
swap_op = "0x1234",
swapped = "0x3412",
reversed = "0x2c48",
le_bytes = "[0x34, 0x12]",
be_bytes = "[0x12, 0x34]",
to_xe_bytes_doc = usize_isize_to_xe_bytes_doc!(),
from_xe_bytes_doc = usize_isize_from_xe_bytes_doc!(),
bound_condition = " on 16-bit targets",
}
widening_impl! { usize, u32, 16, unsigned }
midpoint_impl! { usize, u32, unsigned }
}
try_into
/try_from
or into
/from
as appropriate as
eventually. I hope rust does that.i64()
on a 32-bit integeri64
as
eventually. I hope rust does that .assert_u16()
on an i32
to u16
, crashing if it doesn't fitold build target other data
that's a whole ass sentence.at()
vs []
[]
for the non-UB variant.get_unchecked()
for the UB variant.at()
vs []
as
could also just panic if type doesnt match
bcs index out of bounds does that too[]
for the non-UB variant as
could also just panic if type doesnt match
bcs index out of bounds does that too as
does, so it should probably not change semanticsas
does, so it should probably not change semantics exit
thread-unsafe. but at least it seems they're willing to fix that…std::filesystem
being UBstd::filesystem
that is not UBstd::filesystem
at all even in single threaded contexts might be UB. It says nothing about an external program introducing a file system raceO_CREAT
exposed? (edited)O_CREAT
to open(2)
?OpenOptions::new().read(true).write(true).open("filename")
(edited)openat2(2)
also has some cool functionality with regards to symlinkschar
in type char***
?, ...
and use variadic generics///
)The conversions not listed here are not allowed. In particular,
there are no conversions between pointers and floating types
there are no conversions between pointers to functions and pointers to objects (including void*)
(edited)cl_show_ids
is enabled. Previously, this setting applied to scoreboard and chat, although the setting and config variable descriptions were only mentioning the scoreboard.
Extract client ID formatting in CGameClient::FormatClientId
function to reduce duplicate code and ensure it is consistent.
Correctly indent client IDs also when largest client ID is 100 or larger. Fix scoreboard spectator client ID buffer not being large enough for I...char
in type char***
? char
is the pointee type of char *
maybe