
【计算机语言】
C/C++,Java,Python,PHP等等
rtoax
学习使我快乐,我希望世界和平!
-
转载 C和汇编如何互相调用?
《Linux X64下汇编学习:C语言调用汇编代码,汇编中调用C语言函数》《C语言与汇编语言的区别》《C语言编写汇编的编译器,用c编写一个asm的编译器》《C语言嵌入汇编指令(asm)查询系统时间》《C和汇编如何互相调用?》https://github.com/Rtoax/test/tree/master/asmhttps://github.com/Rtoax/test/tree/master/assembler目录一、gcc 内联汇编格式:参数举例三、ATP2020-12-15 20:50:4759
0
-
转载 volatile与多线程
目录C/C++中volatile的传统用途保证变量的读写操作直接作用于内存阻止编译器打乱变量之间的读写顺序。阻止编译器对变量做激进的优化。比如直接去掉某变量相关的指令。volatile在多线程中的误用非标准的volatile总结C/C++中volatile的传统用途保证变量的读写操作直接作用于内存即每次读的时候都直接去该变量的内存地址中读,每次写的时候都直接写到该变量的内存地址中去。 看下面的例子,如果没加volatile的话,下面这段代码中变量flag的读操作.2020-11-28 19:08:5233
0
-
转载 Linux:C GNU Obstack内存池
目录以下是来自wiki对obstack的介绍:以下为GNU C的Obstack描述:Obstack初始化:在Obstack里面申请对象:释放Obstack里面的对象:可增长内存空间的对象:Obstack 的状态:Obstack 里的数据对齐问题以下是来自wiki对obstack的介绍:Obstack是C标准库里面对内存管理的GNU扩展(实际上就是GNU C library了)。Obstack===Object stack。没错,Obstack就是一个栈,栈里面的.2020-11-10 21:48:1442
0
-
原创 Linux系统调用表
https://www.tutorialspoint.com/unix_system_calls/index.htm List of Unix, Linux System Calls acceptaccessacctadd_keyadjtimexafs_syscallalarmalloc_hugepagesarch_prctlbdflushbindbreakbrkcacheflushchdirchmodchownchrootclone2clonecloseconnectcr...2020-11-08 15:34:31257
0
-
翻译 SeismicUnix: 多维数组alloc.c
/* Copyright (c) Colorado School of Mines, 2011.*//* All rights reserved. *//*********************** self documentation **********************//*****************************...2018-12-27 21:56:53288
0
-
翻译 SeismicUnix:cwpcmaps.c
SU的像素点的三原色搭配,代码的搬运工/* Copyright (c) Colorado School of Mines, 2011.*//* All rights reserved. *//* rongtao study at 2018.12.18 */#ifndef CWP_CMAPS_H#define CWP_CMAPS_H/*...2018-12-19 22:19:12124
0
-
翻译 SeismicUnix:wtlib.c[小波变换库]
拿SU学习编程,真是发现原来上学的时候没有看su源代码真是白瞎了cwp这么无私的研究机构了,/* Copyright (c) Colorado School of Mines, 2011.*//* All rights reserved. *//* WTLIB: $Revision: 1.4 $ ; $Date: 2011/10/20 21:...2018-12-18 22:20:45169
0
-
翻译 SeismicUnix:syscalls.c
/* Copyright (c) Colorado School of Mines, 2011.*//* All rights reserved. *//*********************** self documentation **********************//*****************************...2018-12-18 22:10:30279
0
-
翻译 SeismicUnix:subcalls.c
/* Copyright (c) Colorado School of Mines, 2011.*//* All rights reserved. *//*********************** self documentation **********************//****************************...2018-12-18 22:08:10212
0
-
翻译 SeismicUnix:filestat.c
/* Copyright (c) Colorado School of Mines, 2011.*//* All rights reserved. *//*********************** self documentation **********************//*****************************...2018-12-18 22:00:00744
3
-
翻译 SeismicUnix:[eatoh/eatou/eatoi...]convert ascii to arithmetic and with error checking
/* Copyright (c) Colorado School of Mines, 2011.*//* All rights reserved. *//*********************** self documentation **********************//*****************************...2018-12-18 21:55:36146
0
-
翻译 SeismicUnix的时间函数
#include <sys/time.h>#include <sys/resource.h>float cpusec(){ struct rusage rusage; getrusage(RUSAGE_SELF,&rusage); return ((float)((double)(rusage.ru_utime.tv_sec)+ 1.0e-6*(...2018-12-18 21:37:25160
0
-
原创 SU道头\SEGY卷头头文件cjbsegy.h
#ifndef CJBSEGY_H#define CJBSEGY_H/* TYPEDEFS */typedef struct { /* segy - trace identification header */ int tracl; /* trace sequence number within line */ int tracr; /* trace sequence numb...2018-12-08 16:42:54806
2
-
原创 linux:errno与signum:错误码与信号
Table of Contents先看下cygwin的“sys/errno.h”文件再看一下,signum对应的数值先看下cygwin的“sys/errno.h”文件/* errno is not a global variable, because that would make using it non-reentrant. Instead, its address is returned by the function __errno. */#ifndef _SY2020-05-17 13:29:59198
0
-
原创 POSIX定时器Timer
POSIX Timer间隔定时器 setitimer 有一些重要的缺点,POSIX Timer 对 setitimer 进行了增强,克服了 setitimer 的诸多问题:首先,一个进程同一时刻只能有一个 timer。假如应用需要同时维护多个 Interval 不同的计时器,必须自己写代码来维护。这非常不方便。使用 POSIX Timer,一个进程可以创建任意多个 Timer。 s...2020-04-02 21:49:44266
0
-
原创 __attribute__((unused)),__attribute__((format(scanf,m,n)))
__attribute__ unusedOne of the easiest attributes to use, this marks a variable asintentionallybeing possibly unused. Not only does this quiet the compiler from issuing an unused-variable warning,...2020-02-19 09:19:49156
0
-
原创 __builtin_popcount(s)
#include <stdio.h>//计算一个 32 位无符号整数有多少个位为1#define popcount(s) __builtin_popcount(s)typedef struct { int pid; int sockfd;}mac_t;typedef struct { int id; int fd; int pid; mac_t mac;...2020-02-11 21:32:3193
0
-
转载 System V与Posix
System V和BSD Unix操作系统在操作风格上主要分为System V和BSD(目前一般采用BSD的第4个版本SVR4),前者的代表的操作系统有Solaris操作系统,在Solaris1.X之前,Solaris采用的是BSD风格,2.x之后才投奔System V阵营。后者的代表的操作系统有FreeBSD。 System V:它最初由AT&T开发,曾经也被称为AT&...2020-02-11 20:36:04105
0
-
原创 __attribute__((weak)):弱引用,可以不实现
#include <stdio.h>#define __weak __attribute__((weak))//变量加上weak时,是弱符号。函数加上weak时,是弱引用,可以不实现。//给函数加上weak属性时,即使函数没定义,函数被调用也可以编译成功。//当有两个函数同名时,则使用强符号(也叫全局符号,即没有加weak的函数)来代替弱符号(加weak的函数)。int...2020-02-10 18:20:16284
0
-
原创 彻底领悟__attribute__((section("name")))的奥秘的自动化shell脚本:从零创建init section
I just commit a blog yestoday,https://blog.csdn.net/Rong_Toa/article/details/104063428#!/bin/bash# rongtao 2020.01.22AUTHOR_DEF="Rong Tao"DATE_DEF=`date +%Y/%m/%d`function swap_str_to_c_styl...2020-01-22 15:25:07225
0
-
转载 GCC Attribute Syntax
This section describes the syntax with which __attribute__ may be used, and the constructs to which attribute specifiers bind, for the C language. Some details may vary for C++ and Objective-C. Becaus...2020-01-21 16:45:53297
0
-
原创 __attribute__((section("name"))) study again
目录code treesource codeinit.hinit.cgen-ld.shinit-section.ldsld.ldsmain.cmodule1_init.cmodule2_init.cmakefilecode tree# tree.├── init│ ├── gen-ld.sh│ ├── init.c│ ├─...2020-01-21 16:44:02160
0
-
原创 __attribute__ ((__pure__))
#include <stdio.h>#if __GNUC_PREREQ (2,96)# define _pure __attribute__ ((__pure__))#else# define _pure#endif//这个函数这个函数没有副作用,当不需要它的返回值时,它可以被优化掉,int _pure func1(){ printf("func1 pure t...2020-01-21 16:32:40328
0
-
原创 【GCC】Bug 36793 - x86-64 does not get __sync_synchronize right
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36793Status: RESOLVED FIXED Alias: None Product: gcc Component: target (show other bugs) Version: 4.3.1 Importance:...2019-09-30 08:18:38173
0
-
原创 posix_memalign
Table of Contents预对齐内存的分配其它和对齐有关的预对齐内存的分配在大多数情况下,编译器和C库透明地帮你处理对齐问题。POSIX 标明了通过malloc( ),calloc( ), 和realloc( )返回的地址对于任何的C类型来说都是对齐的。在Linux中,这些函数返回的地址在32位系统是以8字节为边界对齐,在64位系统是以16字节为边界对齐的。有时候,对...2019-03-30 21:01:47326
0
-
原创 glibc-文件类型enum
/* File types for `d_type'. */enum { DT_UNKNOWN = 0,# define DT_UNKNOWN DT_UNKNOWN DT_FIFO = 1,# define DT_FIFO DT_FIFO DT_CHR = 2,# define DT_CHR DT_CHR DT_DIR = 4,# defi...2019-03-09 17:46:05106
0
-
原创 glib库函数:链表、排序表、二叉树、哈希
Table of Contentstree.csortlist.chash.cmessage.clist.cmem.ctree.c/* * File: tree.c */#include <stdio.h>#include <string.h>#include <glib.h>/* * CompareNames...2019-03-03 16:14:25218
1
-
原创 System calls
Kernel programming is vital for as long as new hardware is being designed and produced or old-obsolete hardware is maintained.● A syscall causes a programmed exception (trap) on the CPU○ syscall...2019-02-28 21:54:42135
0
-
原创 glibc-2.9: list.h
list.h nptl\sysdeps\pthread 3151 1/1/2003 26list.h/* Copyright (C) 2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <...2019-02-27 21:50:45331
0
-
转载 __attribute__((const)):只准许调用一次?
the compiler can choose to call the function just once and cache the return value.This attribute marks the function as considering only its numeric parameters. This is mainly intended for the compil...2019-02-26 22:01:55369
0
-
原创 __attribute__((noreturn))
This attribute tells the compiler that the function won't ever return, and this can be used to suppress errors about code paths not being reached. The C library functions abort() and exit() are both d...2019-02-26 22:02:00247
0
-
原创 __attribute__((format(printf,m,n)))
可以使编译器检查函数声明和函数实际调用参数之间的格式化字符串是否匹配。This __attribute__ allows assigning printf-like or scanf-like characteristics to the declared function, and this enables the compiler to check the format string ag...2019-02-25 22:21:05485
0
-
原创 __attribute__((unused)):可能不会用到,消除编译警告
__attribute__ unused:可能不会用到,消除编译警告One of the easiest attributes to use, this marks a variable as intentionally being possibly unused. Not only does this quiet the compiler from issuing an unused-...2019-02-25 22:17:59764
0
-
原创 glibc-2.9: pwd.h
Table of Contentspwd.h include 2156 8/10/2002 pwd.h pwd 6079 7/23/2004 pwd.h include 2156 8/10/2002 #ifndef _PWD_H#include <pwd/pwd.h>/* Now defin...2019-02-25 22:03:09353
0
-
原创 errno:No such file or directory
Table of Contentsdl-minimal.c elf 9436 7/5/2007 205errlist.c sysdeps\gnu 40518 12/25/2005 1errno.h sysdeps\mach\hurd\bits 15606 8/27/2002 dl-minimal.c el...2019-02-25 21:56:26870
0
-
原创 unpipc.h
/* headers on Linux for unpv2 , vonzhou*/#ifndef __unpipc_h#define __unpipc_h#include <sys/types.h> /* basic system data types */#include <sys/time.h> /* timeval{} for select() */...2019-02-23 22:07:00384
0
-
原创 C语言实现Telnet远程终端
Table of Contents服务端server.c客户端client.c头文件mt.hREADME服务端server.c#include "mt.h"#define D(...) fprintf(new_stream, __VA_ARGS__)int main() { int sock; struct sockaddr_in name; char bu...2019-02-23 20:20:493602
3
-
原创 GCC -R -L
cc test.c -L/home/linden -R/home/linden -lfruitThe -L/home/linden -R/home/linden options tell the linker in which directories to look for libraries at linktime and at runtime, respectively.The co...2019-02-10 18:26:061223
0
-
原创 VA
glibc-2.28:err.c misc 3818 2018/8/1 98#define VA(call) \{ \ va_list ap; \ va_start (ap, format); \ call; \ va_en...2019-01-29 21:55:46114
0
-
原创 cygwin不支持__malloc_hook
GLIBC-2.28中malloc.h里面有这样一段:/* Hooks for debugging and user-defined versions. */extern void (*__MALLOC_HOOK_VOLATILE __free_hook) (void *__ptr, c...2019-01-29 21:13:03194
0